| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using System.Collections.Generic; |
| | 6 | |
|
| | 7 | | namespace Azure.Storage.Files.DataLake.Models |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// PathProperties |
| | 11 | | /// </summary> |
| | 12 | | public class PathProperties |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Returns the date and time the path was last modified. Any operation that modifies the path, |
| | 16 | | /// including an update of the path's metadata or properties, changes the last-modified time of the path. |
| | 17 | | /// </summary> |
| 0 | 18 | | public DateTimeOffset LastModified { get; internal set; } |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Returns the date and time the path was created. |
| | 22 | | /// </summary> |
| 644 | 23 | | public DateTimeOffset CreatedOn { get; internal set; } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// The Path's metdata. |
| | 27 | | /// </summary> |
| 684 | 28 | | public IDictionary<string, string> Metadata { get; internal set; } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Conclusion time of the last attempted Copy Blob operation where this path was the destination path. |
| | 32 | | /// This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear |
| | 33 | | /// if a copy is pending, if this path has never been the destination in a Copy path operation, or if this path |
| | 34 | | /// has been modified after a concluded Copy Blob operation using Set path Properties, Put path, or Put Block Li |
| | 35 | | /// </summary> |
| 0 | 36 | | public DateTimeOffset CopyCompletedOn { get; internal set; } |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal |
| | 40 | | /// operation failure. This header does not appear if this path has never been the destination in a Copy Blob op |
| | 41 | | /// or if this path has been modified after a concluded Copy Blob operation using Set Path Properties, Put Blob, |
| | 42 | | /// </summary> |
| 0 | 43 | | public string CopyStatusDescription { get; internal set; } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// String identifier for this copy operation. Use with Get Path Properties to check the status of this copy ope |
| | 47 | | /// or pass to Abort Copy Blob to abort a pending copy. |
| | 48 | | /// </summary> |
| 0 | 49 | | public string CopyId { get; internal set; } |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operat |
| | 53 | | /// path was the destination pth. Can show between 0 and Content-Length bytes copied. This header does not appea |
| | 54 | | /// path has never been the destination in a Copy Blob operation, or if this path has been modified after a conc |
| | 55 | | /// Blob operation using Set Blob Properties, Put Blob, or Put Block List |
| | 56 | | /// </summary> |
| 0 | 57 | | public string CopyProgress { get; internal set; } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// URL up to 2 KB in length that specifies the source path or file used in the last attempted Copy Blob operati |
| | 61 | | /// this path was the destination path. This header does not appear if this path has never been the destination |
| | 62 | | /// Blob operation, or if this path has been modified after a concluded Copy Blob operation using Set Path Prope |
| | 63 | | /// Blob, or Put Block List. |
| | 64 | | /// </summary> |
| 0 | 65 | | public Uri CopySource { get; internal set; } |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// State of the copy operation identified by x-ms-copy-id. |
| | 69 | | /// </summary> |
| 0 | 70 | | public CopyStatus CopyStatus { get; internal set; } |
| | 71 | |
|
| | 72 | | /// <summary> |
| | 73 | | /// Included if the path is incremental copy blob. |
| | 74 | | /// </summary> |
| 0 | 75 | | public bool IsIncrementalCopy { get; internal set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// When a path is leased, specifies whether the lease is of infinite or fixed duration. |
| | 79 | | /// </summary> |
| 0 | 80 | | public DataLakeLeaseDuration LeaseDuration { get; internal set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Lease state of the path. |
| | 84 | | /// </summary> |
| 0 | 85 | | public DataLakeLeaseState LeaseState { get; internal set; } |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// The current lease status of the path. |
| | 89 | | /// </summary> |
| 0 | 90 | | public DataLakeLeaseStatus LeaseStatus { get; internal set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// The number of bytes present in the response body. |
| | 94 | | /// </summary> |
| 0 | 95 | | public long ContentLength { get; internal set; } |
| | 96 | |
|
| | 97 | | /// <summary> |
| | 98 | | /// The content type specified for the path. The default content type is 'application/octet-stream' |
| | 99 | | /// </summary> |
| 672 | 100 | | public string ContentType { get; internal set; } |
| | 101 | |
|
| | 102 | | /// <summary> |
| | 103 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 104 | | /// the ETag value will be in quotes. |
| | 105 | | /// </summary> |
| 924 | 106 | | public ETag ETag { get; internal set; } |
| | 107 | |
|
| | 108 | | /// <summary> |
| | 109 | | /// If the path has an MD5 hash and this operation is to read the full path, this response header is returned so |
| | 110 | | /// check for message content integrity. |
| | 111 | | /// </summary> |
| | 112 | | #pragma warning disable CA1819 // Properties should not return arrays |
| 648 | 113 | | public byte[] ContentHash { get; internal set; } |
| | 114 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 115 | |
|
| | 116 | | /// <summary> |
| | 117 | | /// This header returns the value that was specified for the Content-Encoding request header |
| | 118 | | /// </summary> |
| 672 | 119 | | public string ContentEncoding { get; internal set; } |
| | 120 | |
|
| | 121 | | /// <summary> |
| | 122 | | /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. |
| | 123 | | /// The Content-Disposition response header field conveys additional information about how to process the respon |
| | 124 | | /// and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the |
| | 125 | | /// should not display the response, but instead show a Save As dialog with a filename other than the path name |
| | 126 | | /// </summary> |
| 672 | 127 | | public string ContentDisposition { get; internal set; } |
| | 128 | |
|
| | 129 | | /// <summary> |
| | 130 | | /// This header returns the value that was specified for the Content-Language request header. |
| | 131 | | /// </summary> |
| 672 | 132 | | public string ContentLanguage { get; internal set; } |
| | 133 | |
|
| | 134 | | /// <summary> |
| | 135 | | /// This header is returned if it was previously specified for the path. |
| | 136 | | /// </summary> |
| 672 | 137 | | public string CacheControl { get; internal set; } |
| | 138 | |
|
| | 139 | | /// <summary> |
| | 140 | | /// Indicates that the service supports requests for partial path content. |
| | 141 | | /// </summary> |
| 0 | 142 | | public string AcceptRanges { get; internal set; } |
| | 143 | |
|
| | 144 | | /// <summary> |
| | 145 | | /// The value of this header is set to true if the path data and application metadata are completely encrypted u |
| | 146 | | /// specified algorithm. Otherwise, the value is set to false (when the path is unencrypted, or if only parts of |
| | 147 | | /// metadata are encrypted). |
| | 148 | | /// </summary> |
| 0 | 149 | | public bool IsServerEncrypted { get; internal set; } |
| | 150 | |
|
| | 151 | | /// <summary> |
| | 152 | | /// The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the m |
| | 153 | | /// was encrypted with a customer-provided key. |
| | 154 | | /// </summary> |
| 0 | 155 | | public string EncryptionKeySha256 { get; internal set; } |
| | 156 | |
|
| | 157 | | /// <summary> |
| | 158 | | /// The tier of block blob on blob storage LRS accounts. For blob storage LRS accounts, valid values are Hot/Coo |
| | 159 | | /// </summary> |
| 0 | 160 | | public string AccessTier { get; internal set; } |
| | 161 | |
|
| | 162 | | /// <summary> |
| | 163 | | /// For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. |
| | 164 | | /// If the blob is being rehydrated and is not complete then this header is returned indicating that rehydrate i |
| | 165 | | /// and also tells the destination tier. |
| | 166 | | /// </summary> |
| 0 | 167 | | public string ArchiveStatus { get; internal set; } |
| | 168 | |
|
| | 169 | | /// <summary> |
| | 170 | | /// The time the tier was changed on the object. This is only returned if the tier on the block blob was ever se |
| | 171 | | /// </summary> |
| 0 | 172 | | public DateTimeOffset AccessTierChangedOn { get; internal set; } |
| | 173 | |
|
| | 174 | | /// <summary> |
| | 175 | | /// The time the path will be deleted. |
| | 176 | | /// </summary> |
| 652 | 177 | | public DateTimeOffset ExpiresOn { get; internal set; } |
| | 178 | |
|
| | 179 | | /// <summary> |
| | 180 | | /// If this path represents a directory. |
| | 181 | | /// </summary> |
| | 182 | | public bool IsDirectory |
| | 183 | | { |
| 8 | 184 | | get => Metadata.TryGetValue(Constants.DataLake.IsDirectoryKey, out string isDirectoryValue) |
| 8 | 185 | | && bool.TryParse(isDirectoryValue, out bool isDirectory) |
| 8 | 186 | | && isDirectory; |
| | 187 | |
|
| | 188 | | internal set |
| | 189 | | { |
| | 190 | | // True |
| 0 | 191 | | if (value) |
| | 192 | | { |
| 0 | 193 | | Metadata[Constants.DataLake.IsDirectoryKey] = bool.TrueString.ToLowerInvariant(); |
| | 194 | | } |
| | 195 | | // False |
| | 196 | | else |
| | 197 | | { |
| 0 | 198 | | Metadata.Remove(Constants.DataLake.IsDirectoryKey); |
| | 199 | | } |
| 0 | 200 | | } |
| | 201 | | } |
| | 202 | |
|
| | 203 | | /// <summary> |
| | 204 | | /// Prevent direct instantiation of PathProperties instances. |
| | 205 | | /// You can use DataLakeModelFactory.PathProperties instead. |
| | 206 | | /// </summary> |
| 1272 | 207 | | internal PathProperties() { } |
| | 208 | | } |
| | 209 | | } |