| | 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 | | /// Subset of the file's properties. |
| | 14 | | /// </summary> |
| | 15 | | public class ShareFileInfo |
| | 16 | | { |
| | 17 | | /// <summary> |
| | 18 | | /// The internal RawStorageFileInfo. |
| | 19 | | /// </summary> |
| | 20 | | internal RawStorageFileInfo _rawStorageFileInfo; |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// The ETag contains a value which represents the version of the file, in quotes. |
| | 24 | | /// </summary> |
| 34 | 25 | | public ETag ETag => _rawStorageFileInfo.ETag; |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// Returns the date and time the file was last modified. |
| | 29 | | /// </summary> |
| 14 | 30 | | public DateTimeOffset LastModified => _rawStorageFileInfo.LastModified; |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// The value of this header is set to true if the contents of the request are successfully encrypted using the |
| | 34 | | /// </summary> |
| 14 | 35 | | public bool IsServerEncrypted => _rawStorageFileInfo.IsServerEncrypted; |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// The file's SMB properties. |
| | 39 | | /// </summary> |
| 292 | 40 | | public FileSmbProperties SmbProperties { get; set; } |
| | 41 | |
|
| 254 | 42 | | internal ShareFileInfo(RawStorageFileInfo rawStorageFileInfo) |
| | 43 | | { |
| 254 | 44 | | _rawStorageFileInfo = rawStorageFileInfo; |
| 254 | 45 | | SmbProperties = new FileSmbProperties(rawStorageFileInfo); |
| 254 | 46 | | } |
| | 47 | | } |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// FilesModelFactory provides utilities for mocking. |
| | 51 | | /// </summary> |
| | 52 | | public static partial class FilesModelFactory |
| | 53 | | { |
| | 54 | | /// <summary> |
| | 55 | | /// Creates a new StorageFileInfo instance for mocking. |
| | 56 | | /// </summary> |
| | 57 | | public static ShareFileInfo StorageFileInfo( |
| | 58 | | ETag eTag, |
| | 59 | | DateTimeOffset lastModified, |
| | 60 | | bool isServerEncrypted, |
| | 61 | | string filePermissionKey, |
| | 62 | | string fileAttributes, |
| | 63 | | DateTimeOffset fileCreationTime, |
| | 64 | | DateTimeOffset fileLastWriteTime, |
| | 65 | | DateTimeOffset fileChangeTime, |
| | 66 | | string fileId, |
| | 67 | | string fileParentId |
| | 68 | | ) |
| | 69 | | => new ShareFileInfo(new RawStorageFileInfo() |
| | 70 | | { |
| | 71 | | ETag = eTag, |
| | 72 | | LastModified = lastModified, |
| | 73 | | IsServerEncrypted = isServerEncrypted, |
| | 74 | | FilePermissionKey = filePermissionKey, |
| | 75 | | FileAttributes = fileAttributes, |
| | 76 | | FileCreationTime = fileCreationTime, |
| | 77 | | FileLastWriteTime = fileLastWriteTime, |
| | 78 | | FileChangeTime = fileChangeTime, |
| | 79 | | FileId = fileId, |
| | 80 | | FileParentId = fileParentId |
| | 81 | | }); |
| | 82 | | } |
| | 83 | | } |