|
| 1 | +//go:build go1.18 |
| 2 | +// +build go1.18 |
| 3 | + |
| 4 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 5 | +// Licensed under the MIT License. See License.txt in the project root for license information. |
| 6 | + |
| 7 | +package directory |
| 8 | + |
| 9 | +import ( |
| 10 | + "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob" |
| 11 | + "github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake" |
| 12 | + "github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/exported" |
| 13 | + "github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/generated" |
| 14 | + "github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/path" |
| 15 | + "github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/shared" |
| 16 | + "time" |
| 17 | +) |
| 18 | + |
| 19 | +// CreateOptions contains the optional parameters when calling the Create operation. dfs endpoint |
| 20 | +type CreateOptions struct { |
| 21 | + // AccessConditions contains parameters for accessing the file. |
| 22 | + AccessConditions *azdatalake.AccessConditions |
| 23 | + // Metadata is a map of name-value pairs to associate with the file storage object. |
| 24 | + Metadata map[string]*string |
| 25 | + // CPKInfo contains a group of parameters for client provided encryption key. |
| 26 | + CPKInfo *CPKInfo |
| 27 | + // HTTPHeaders contains the HTTP headers for path operations. |
| 28 | + HTTPHeaders *HTTPHeaders |
| 29 | + //PathExpiryOptions *ExpiryOptions |
| 30 | + // LeaseDuration specifies the duration of the lease. |
| 31 | + LeaseDuration *time.Duration |
| 32 | + // ProposedLeaseID specifies the proposed lease ID for the file. |
| 33 | + ProposedLeaseID *string |
| 34 | + // Permissions is the octal representation of the permissions for user, group and mask. |
| 35 | + Permissions *string |
| 36 | + // Umask is the umask for the file. |
| 37 | + Umask *string |
| 38 | + // Owner is the owner of the file. |
| 39 | + Owner *string |
| 40 | + // Group is the owning group of the file. |
| 41 | + Group *string |
| 42 | + // ACL is the access control list for the file. |
| 43 | + ACL *string |
| 44 | +} |
| 45 | + |
| 46 | +func (o *CreateOptions) format() (*generated.LeaseAccessConditions, *generated.ModifiedAccessConditions, *generated.PathHTTPHeaders, error) { |
| 47 | + // TODO: add all other required options for the create operation, we don't need sourceModAccCond since this is not rename |
| 48 | + leaseAccessConditions, modifiedAccessConditions := shared.FormatPathAccessConditions(o.AccessConditions) |
| 49 | + httpHeaders := &generated.PathHTTPHeaders{ |
| 50 | + CacheControl: o.HTTPHeaders.CacheControl, |
| 51 | + ContentDisposition: o.HTTPHeaders.ContentDisposition, |
| 52 | + ContentEncoding: o.HTTPHeaders.ContentEncoding, |
| 53 | + ContentLanguage: o.HTTPHeaders.ContentLanguage, |
| 54 | + ContentMD5: o.HTTPHeaders.ContentMD5, |
| 55 | + ContentType: o.HTTPHeaders.ContentType, |
| 56 | + TransactionalContentHash: o.HTTPHeaders.ContentMD5, |
| 57 | + } |
| 58 | + return leaseAccessConditions, modifiedAccessConditions, httpHeaders, nil |
| 59 | +} |
| 60 | + |
| 61 | +// DeleteOptions contains the optional parameters when calling the Delete operation. dfs endpoint |
| 62 | +type DeleteOptions struct { |
| 63 | + // AccessConditions specifies parameters for accessing the directory |
| 64 | + AccessConditions *azdatalake.AccessConditions |
| 65 | +} |
| 66 | + |
| 67 | +func (o *DeleteOptions) format() (*generated.LeaseAccessConditions, *generated.ModifiedAccessConditions, error) { |
| 68 | + leaseAccessConditions, modifiedAccessConditions := shared.FormatPathAccessConditions(o.AccessConditions) |
| 69 | + return leaseAccessConditions, modifiedAccessConditions, nil |
| 70 | +} |
| 71 | + |
| 72 | +type RenameOptions struct { |
| 73 | + // SourceModifiedAccessConditions specifies parameters for accessing the source directory |
| 74 | + SourceModifiedAccessConditions *SourceModifiedAccessConditions |
| 75 | + // AccessConditions specifies parameters for accessing the destination directory |
| 76 | + AccessConditions *azdatalake.AccessConditions |
| 77 | +} |
| 78 | + |
| 79 | +// GetPropertiesOptions contains the optional parameters for the Client.GetProperties method |
| 80 | +type GetPropertiesOptions struct { |
| 81 | + AccessConditions *azdatalake.AccessConditions |
| 82 | + CPKInfo *CPKInfo |
| 83 | +} |
| 84 | + |
| 85 | +func (o *GetPropertiesOptions) format() *blob.GetPropertiesOptions { |
| 86 | + if o == nil { |
| 87 | + return nil |
| 88 | + } |
| 89 | + accessConditions := shared.FormatBlobAccessConditions(o.AccessConditions) |
| 90 | + return &blob.GetPropertiesOptions{ |
| 91 | + AccessConditions: accessConditions, |
| 92 | + CPKInfo: &blob.CPKInfo{ |
| 93 | + EncryptionKey: o.CPKInfo.EncryptionKey, |
| 94 | + EncryptionAlgorithm: o.CPKInfo.EncryptionAlgorithm, |
| 95 | + EncryptionKeySHA256: o.CPKInfo.EncryptionKeySHA256, |
| 96 | + }, |
| 97 | + } |
| 98 | +} |
| 99 | + |
| 100 | +// ===================================== PATH IMPORTS =========================================== |
| 101 | + |
| 102 | +// CPKInfo contains a group of parameters for client provided encryption key. |
| 103 | +type CPKInfo = path.CPKInfo |
| 104 | + |
| 105 | +// CPKScopeInfo contains a group of parameters for client provided encryption scope. |
| 106 | +type CPKScopeInfo = path.CPKScopeInfo |
| 107 | + |
| 108 | +// HTTPHeaders contains the HTTP headers for path operations. |
| 109 | +type HTTPHeaders = path.HTTPHeaders |
| 110 | + |
| 111 | +// SourceModifiedAccessConditions identifies the source path access conditions. |
| 112 | +type SourceModifiedAccessConditions = path.SourceModifiedAccessConditions |
| 113 | + |
| 114 | +// SetAccessControlOptions contains the optional parameters when calling the SetAccessControl operation. |
| 115 | +type SetAccessControlOptions = path.SetAccessControlOptions |
| 116 | + |
| 117 | +// GetAccessControlOptions contains the optional parameters when calling the GetAccessControl operation. |
| 118 | +type GetAccessControlOptions = path.GetAccessControlOptions |
| 119 | + |
| 120 | +// SetAccessControlRecursiveOptions contains the optional parameters when calling the SetAccessControlRecursive operation. |
| 121 | +type SetAccessControlRecursiveOptions = path.SetAccessControlRecursiveOptions |
| 122 | + |
| 123 | +// SetMetadataOptions contains the optional parameters when calling the SetMetadata operation. |
| 124 | +type SetMetadataOptions = path.SetMetadataOptions |
| 125 | + |
| 126 | +// SetHTTPHeadersOptions contains the optional parameters when calling the SetHTTPHeaders operation. |
| 127 | +type SetHTTPHeadersOptions = path.SetHTTPHeadersOptions |
| 128 | + |
| 129 | +// RemoveAccessControlRecursiveOptions contains the optional parameters when calling the RemoveAccessControlRecursive operation. |
| 130 | +type RemoveAccessControlRecursiveOptions = path.RemoveAccessControlRecursiveOptions |
| 131 | + |
| 132 | +// UpdateAccessControlRecursiveOptions contains the optional parameters when calling the UpdateAccessControlRecursive operation. |
| 133 | +type UpdateAccessControlRecursiveOptions = path.UpdateAccessControlRecursiveOptions |
| 134 | + |
| 135 | +// SharedKeyCredential contains an account's name and its primary or secondary key. |
| 136 | +type SharedKeyCredential = exported.SharedKeyCredential |
0 commit comments