| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using System.Collections.Generic; |
| | 6 | | using System.Text; |
| | 7 | |
|
| | 8 | | #pragma warning disable SA1402 // File may only contain a single type |
| | 9 | |
|
| | 10 | | namespace Azure.Storage.Files.Shares.Models |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Properites for a directory. |
| | 14 | | /// </summary> |
| | 15 | | public class ShareDirectoryProperties |
| | 16 | | { |
| | 17 | | /// <summary> |
| | 18 | | /// The internal RawStorageDirectoryProperties |
| | 19 | | /// </summary> |
| | 20 | | internal RawStorageDirectoryProperties _rawStorageDirectoryProperties; |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// A set of name-value pairs that contain metadata for the directory. |
| | 24 | | /// </summary> |
| 4 | 25 | | public IDictionary<string, string> Metadata => _rawStorageDirectoryProperties.Metadata; |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// The ETag contains a value that you can use to perform operations conditionally, in quotes. |
| | 29 | | /// </summary> |
| 28 | 30 | | public ETag ETag => _rawStorageDirectoryProperties.ETag; |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Returns DateTimeOffest the directory was last modified. Operations on files within the directory |
| | 34 | | /// do not affect the last modified time of the directory. |
| | 35 | | /// </summary> |
| 2 | 36 | | public DateTimeOffset LastModified => _rawStorageDirectoryProperties.LastModified; |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Set to true if the directory metadata is completely encrypted using the specified algorithm. |
| | 40 | | /// Otherwise, the value is set to false. |
| | 41 | | /// </summary> |
| 0 | 42 | | public bool IsServerEncrypted => _rawStorageDirectoryProperties.IsServerEncrypted; |
| | 43 | |
|
| | 44 | | /// <summary> |
| | 45 | | /// The SMB properties for the directory. |
| | 46 | | /// </summary> |
| 42 | 47 | | public FileSmbProperties SmbProperties { get; set; } |
| | 48 | |
|
| 40 | 49 | | internal ShareDirectoryProperties(RawStorageDirectoryProperties rawStorageDirectoryProperties) |
| | 50 | | { |
| 40 | 51 | | _rawStorageDirectoryProperties = rawStorageDirectoryProperties; |
| 40 | 52 | | SmbProperties = new FileSmbProperties(rawStorageDirectoryProperties); |
| 40 | 53 | | } |
| | 54 | | } |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// FilesModelFactory provides utilities for mocking. |
| | 58 | | /// </summary> |
| | 59 | | public static partial class FilesModelFactory |
| | 60 | | { |
| | 61 | | /// <summary> |
| | 62 | | /// Creates a new StorageDirectoryProperties instance for mocking. |
| | 63 | | /// </summary> |
| | 64 | | public static ShareDirectoryProperties StorageDirectoryProperties( |
| | 65 | | IDictionary<string, string> metadata, |
| | 66 | | ETag eTag, |
| | 67 | | DateTimeOffset lastModified, |
| | 68 | | bool isServerEncrypted, |
| | 69 | | string fileAttributes, |
| | 70 | | DateTimeOffset fileCreationTime, |
| | 71 | | DateTimeOffset fileLastWriteTime, |
| | 72 | | DateTimeOffset fileChangeTime, |
| | 73 | | string filePermissionKey, |
| | 74 | | string fileId, |
| | 75 | | string fileParentId |
| | 76 | | ) |
| | 77 | | => new ShareDirectoryProperties(new RawStorageDirectoryProperties() |
| | 78 | | { |
| | 79 | | Metadata = metadata, |
| | 80 | | ETag = eTag, |
| | 81 | | LastModified = lastModified, |
| | 82 | | IsServerEncrypted = isServerEncrypted, |
| | 83 | | FileAttributes = fileAttributes, |
| | 84 | | FileCreationTime = fileCreationTime, |
| | 85 | | FileLastWriteTime = fileLastWriteTime, |
| | 86 | | FileChangeTime = fileChangeTime, |
| | 87 | | FilePermissionKey = filePermissionKey, |
| | 88 | | FileId = fileId, |
| | 89 | | FileParentId = fileParentId |
| | 90 | | }); |
| | 91 | | } |
| | 92 | | } |