| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | 3 | | // |
| | 4 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 5 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 6 | | // regenerated. |
| | 7 | |
|
| | 8 | | // |
| | 9 | | // This file was autogenerated by a tool. |
| | 10 | | // Do not modify it. |
| | 11 | | // |
| | 12 | |
|
| | 13 | | namespace Microsoft.Azure.Batch |
| | 14 | | { |
| | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| | 16 | | using System; |
| | 17 | | using System.Collections.Generic; |
| | 18 | | using System.Linq; |
| | 19 | |
|
| 1 | 20 | | /// <summary> |
| | 21 | | /// A file to be downloaded to a compute node from Azure Blob Storage, such as task executables and task input data |
| | 22 | | /// </summary> |
| | 23 | | public partial class ResourceFile : ITransportObjectProvider<Models.ResourceFile>, IPropertyMetadata |
| | 24 | | { |
| | 25 | | #region Constructors |
| | 26 | | /// <summary> |
| | 27 | | /// Initializes a new instance of the <see cref="ResourceFile"/> class. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name='httpUrl'>The URL of the file to download.</param> |
| | 30 | | /// <param name='fileMode'>The file permission mode attribute in octal format.</param> |
| | 31 | | /// <param name='filePath'>The location on the compute node to which to download the file(s), relative to the ta |
| | 32 | | /// <param name='storageContainerUrl'>The URL of the blob container within Azure Blob Storage.</param> |
| | 33 | | /// <param name='autoStorageContainerName'>The storage container name in the auto storage account.</param> |
| 0 | 34 | | /// <param name='blobPrefix'>The blob prefix to use when downloading blobs from an Azure Storage container. Only |
| | 35 | | /// with the specified prefix will be downloaded.</param> |
| 2530 | 36 | | internal ResourceFile( |
| 2530 | 37 | | string httpUrl = default(string), |
| 2530 | 38 | | string fileMode = default(string), |
| 2530 | 39 | | string filePath = default(string), |
| 2530 | 40 | | string storageContainerUrl = default(string), |
| 2530 | 41 | | string autoStorageContainerName = default(string), |
| 2530 | 42 | | string blobPrefix = default(string)) |
| | 43 | | { |
| 2530 | 44 | | this.HttpUrl = httpUrl; |
| 2530 | 45 | | this.FileMode = fileMode; |
| 2530 | 46 | | this.FilePath = filePath; |
| 2530 | 47 | | this.StorageContainerUrl = storageContainerUrl; |
| 2530 | 48 | | this.AutoStorageContainerName = autoStorageContainerName; |
| 2530 | 49 | | this.BlobPrefix = blobPrefix; |
| 2530 | 50 | | } |
| | 51 | |
|
| 10965 | 52 | | internal ResourceFile(Models.ResourceFile protocolObject) |
| | 53 | | { |
| 10965 | 54 | | this.AutoStorageContainerName = protocolObject.AutoStorageContainerName; |
| 10965 | 55 | | this.BlobPrefix = protocolObject.BlobPrefix; |
| 10965 | 56 | | this.FileMode = protocolObject.FileMode; |
| 10965 | 57 | | this.FilePath = protocolObject.FilePath; |
| 10965 | 58 | | this.HttpUrl = protocolObject.HttpUrl; |
| 10965 | 59 | | this.StorageContainerUrl = protocolObject.StorageContainerUrl; |
| 10965 | 60 | | } |
| | 61 | |
|
| | 62 | | #endregion Constructors |
| | 63 | |
|
| | 64 | | #region ResourceFile |
| | 65 | |
|
| | 66 | | /// <summary> |
| | 67 | | /// Gets the storage container name in the auto storage account. |
| | 68 | | /// </summary> |
| 16022 | 69 | | public string AutoStorageContainerName { get; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets the blob prefix to use when downloading blobs from an Azure Storage container. Only the blobs whose nam |
| | 73 | | /// begin with the specified prefix will be downloaded. |
| | 74 | | /// </summary> |
| | 75 | | /// <remarks> |
| | 76 | | /// This property is valid only when <see cref="AutoStorageContainerName" /> or <see cref="StorageContainerUrl" |
| | 77 | | /// is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the file |
| | 78 | | /// in the container will be downloaded. |
| | 79 | | /// </remarks> |
| 16022 | 80 | | public string BlobPrefix { get; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Gets the file permission mode attribute in octal format. |
| | 84 | | /// </summary> |
| | 85 | | /// <remarks> |
| | 86 | | /// <para>This property is applicable only if the resource file is downloaded to a Linux node. This property wil |
| | 87 | | /// be ignored if it is specified for a <see cref="ResourceFile"/> which will be downloaded to a Windows node. I |
| | 88 | | /// this property is not specified for a Linux node, then the default value is 0770.</para> |
| | 89 | | /// </remarks> |
| 16022 | 90 | | public string FileMode { get; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// Gets the location on the compute node to which to download the file(s), relative to the task's working direc |
| | 94 | | /// </summary> |
| | 95 | | /// <remarks> |
| | 96 | | /// If the <see cref="HttpUrl" /> property is specified, this is required and describes the path which the file |
| | 97 | | /// be downloaded to, including the filename. Otherwise, if the <see cref="AutoStorageContainerName" /> or <see |
| | 98 | | /// /> property is specified, this is optional and is the directory to download the files to. In the case where |
| | 99 | | /// is used as a directory, any directory structure already associated with the input data will be retained in f |
| | 100 | | /// and appended to the specified <see cref="FilePath" /> directory. The specified relative path cannot break ou |
| | 101 | | /// of the task's working directory (for example by using '..'). |
| | 102 | | /// </remarks> |
| 16022 | 103 | | public string FilePath { get; } |
| | 104 | |
|
| | 105 | | /// <summary> |
| | 106 | | /// Gets the URL of the file to download. |
| | 107 | | /// </summary> |
| | 108 | | /// <remarks> |
| | 109 | | /// If the URL is Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service doe |
| | 110 | | /// not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Az |
| | 111 | | /// storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for t |
| | 112 | | /// blob or its container to allow public access. |
| | 113 | | /// </remarks> |
| 16022 | 114 | | public string HttpUrl { get; } |
| | 115 | |
|
| | 116 | | /// <summary> |
| | 117 | | /// Gets the URL of the blob container within Azure Blob Storage. |
| | 118 | | /// </summary> |
| | 119 | | /// <remarks> |
| | 120 | | /// This URL must be readable and listable using anonymous access; that is, the Batch service does not present a |
| | 121 | | /// credentials when downloading blobs from the container. There are two ways to get such a URL for a container |
| | 122 | | /// Azure storage: include a Shared Access Signature (SAS) granting read permissions on the container, or set th |
| | 123 | | /// ACL for the container to allow public access. |
| | 124 | | /// </remarks> |
| 16022 | 125 | | public string StorageContainerUrl { get; } |
| | 126 | |
|
| | 127 | | #endregion // ResourceFile |
| | 128 | |
|
| | 129 | | #region IPropertyMetadata |
| | 130 | |
|
| | 131 | | bool IModifiable.HasBeenModified |
| | 132 | | { |
| | 133 | | //This class is compile time readonly so it cannot have been modified |
| 1 | 134 | | get { return false; } |
| | 135 | | } |
| | 136 | |
|
| | 137 | | bool IReadOnly.IsReadOnly |
| | 138 | | { |
| 0 | 139 | | get { return true; } |
| | 140 | | set |
| | 141 | | { |
| | 142 | | // This class is compile time readonly already |
| 26095 | 143 | | } |
| | 144 | | } |
| | 145 | |
|
| | 146 | | #endregion // IPropertyMetadata |
| | 147 | |
|
| | 148 | | #region Internal/private methods |
| | 149 | |
|
| | 150 | | /// <summary> |
| | 151 | | /// Return a protocol object of the requested type. |
| | 152 | | /// </summary> |
| | 153 | | /// <returns>The protocol object of the requested type.</returns> |
| | 154 | | Models.ResourceFile ITransportObjectProvider<Models.ResourceFile>.GetTransportObject() |
| | 155 | | { |
| 2529 | 156 | | Models.ResourceFile result = new Models.ResourceFile() |
| 2529 | 157 | | { |
| 2529 | 158 | | AutoStorageContainerName = this.AutoStorageContainerName, |
| 2529 | 159 | | BlobPrefix = this.BlobPrefix, |
| 2529 | 160 | | FileMode = this.FileMode, |
| 2529 | 161 | | FilePath = this.FilePath, |
| 2529 | 162 | | HttpUrl = this.HttpUrl, |
| 2529 | 163 | | StorageContainerUrl = this.StorageContainerUrl, |
| 2529 | 164 | | }; |
| | 165 | |
|
| 2529 | 166 | | return result; |
| | 167 | | } |
| | 168 | |
|
| | 169 | | /// <summary> |
| | 170 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | 171 | | /// </summary> |
| | 172 | | internal static IList<ResourceFile> ConvertFromProtocolCollection(IEnumerable<Models.ResourceFile> protoCollecti |
| | 173 | | { |
| 3318 | 174 | | ConcurrentChangeTrackedModifiableList<ResourceFile> converted = UtilitiesInternal.CollectionToThreadSafeColl |
| 3318 | 175 | | items: protoCollection, |
| 10791 | 176 | | objectCreationFunc: o => new ResourceFile(o)); |
| | 177 | |
|
| 3318 | 178 | | return converted; |
| | 179 | | } |
| | 180 | |
|
| | 181 | | /// <summary> |
| | 182 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | 183 | | /// </summary> |
| | 184 | | internal static IList<ResourceFile> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.ResourceFile> prot |
| | 185 | | { |
| 1539 | 186 | | ConcurrentChangeTrackedModifiableList<ResourceFile> converted = UtilitiesInternal.CollectionToThreadSafeColl |
| 1539 | 187 | | items: protoCollection, |
| 5031 | 188 | | objectCreationFunc: o => new ResourceFile(o).Freeze()); |
| | 189 | |
|
| 2302 | 190 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | 191 | |
|
| 1539 | 192 | | return converted; |
| | 193 | | } |
| | 194 | |
|
| | 195 | | /// <summary> |
| | 196 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | 197 | | /// and returned as a readonly collection. |
| | 198 | | /// </summary> |
| | 199 | | internal static IReadOnlyList<ResourceFile> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.ResourceFil |
| | 200 | | { |
| 0 | 201 | | IReadOnlyList<ResourceFile> converted = |
| 0 | 202 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| 0 | 203 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| 0 | 204 | | items: protoCollection, |
| 0 | 205 | | objectCreationFunc: o => new ResourceFile(o).Freeze()), o => o.AsReadOnly()); |
| | 206 | |
|
| 0 | 207 | | return converted; |
| | 208 | | } |
| | 209 | |
|
| | 210 | | #endregion // Internal/private methods |
| | 211 | | } |
| | 212 | | } |