|   |  | 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 |  |  | 
|   |  | 20 |  |     /// <summary> | 
|   |  | 21 |  |     /// Settings which will be used by the data disks associated to compute nodes in the pool. | 
|   |  | 22 |  |     /// </summary> | 
|   |  | 23 |  |     public partial class DataDisk : ITransportObjectProvider<Models.DataDisk>, IPropertyMetadata | 
|   |  | 24 |  |     { | 
|   |  | 25 |  |         #region Constructors | 
|   |  | 26 |  |         /// <summary> | 
|   |  | 27 |  |         /// Initializes a new instance of the <see cref="DataDisk"/> class. | 
|   |  | 28 |  |         /// </summary> | 
|   |  | 29 |  |         /// <param name='lun'>The logical unit number.</param> | 
|   |  | 30 |  |         /// <param name='diskSizeGB'>The initial disk size in gigabytes.</param> | 
|   |  | 31 |  |         /// <param name='caching'>The type of caching to enable for the OS disk.</param> | 
|   |  | 32 |  |         /// <param name='storageAccountType'>The storage account type to be used for the data disk.</param> | 
|   | 633 | 33 |  |         public DataDisk( | 
|   | 633 | 34 |  |             int lun, | 
|   | 633 | 35 |  |             int diskSizeGB, | 
|   | 633 | 36 |  |             Common.CachingType? caching = default(Common.CachingType?), | 
|   | 633 | 37 |  |             Common.StorageAccountType? storageAccountType = default(Common.StorageAccountType?)) | 
|   |  | 38 |  |         { | 
|   | 633 | 39 |  |             this.Lun = lun; | 
|   | 633 | 40 |  |             this.DiskSizeGB = diskSizeGB; | 
|   | 633 | 41 |  |             this.Caching = caching; | 
|   | 633 | 42 |  |             this.StorageAccountType = storageAccountType; | 
|   | 633 | 43 |  |         } | 
|   |  | 44 |  |  | 
|   | 1287 | 45 |  |         internal DataDisk(Models.DataDisk protocolObject) | 
|   |  | 46 |  |         { | 
|   | 1287 | 47 |  |             this.Caching = UtilitiesInternal.MapNullableEnum<Models.CachingType, Common.CachingType>(protocolObject.Cach | 
|   | 1287 | 48 |  |             this.DiskSizeGB = protocolObject.DiskSizeGB; | 
|   | 1287 | 49 |  |             this.Lun = protocolObject.Lun; | 
|   | 1287 | 50 |  |             this.StorageAccountType = UtilitiesInternal.MapNullableEnum<Models.StorageAccountType, Common.StorageAccount | 
|   | 1287 | 51 |  |         } | 
|   |  | 52 |  |  | 
|   |  | 53 |  |         #endregion Constructors | 
|   |  | 54 |  |  | 
|   |  | 55 |  |         #region DataDisk | 
|   |  | 56 |  |  | 
|   |  | 57 |  |         /// <summary> | 
|   |  | 58 |  |         /// Gets the type of caching to enable for the OS disk. | 
|   |  | 59 |  |         /// </summary> | 
|   |  | 60 |  |         /// <remarks> | 
|   |  | 61 |  |         /// If omitted, the default is <see cref="Common.CachingType.ReadWrite" />. | 
|   |  | 62 |  |         /// </remarks> | 
|   | 2552 | 63 |  |         public Common.CachingType? Caching { get; } | 
|   |  | 64 |  |  | 
|   |  | 65 |  |         /// <summary> | 
|   |  | 66 |  |         /// Gets the initial disk size in gigabytes. | 
|   |  | 67 |  |         /// </summary> | 
|   | 2552 | 68 |  |         public int DiskSizeGB { get; } | 
|   |  | 69 |  |  | 
|   |  | 70 |  |         /// <summary> | 
|   |  | 71 |  |         /// Gets the logical unit number. | 
|   |  | 72 |  |         /// </summary> | 
|   |  | 73 |  |         /// <remarks> | 
|   |  | 74 |  |         /// The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinc | 
|   |  | 75 |  |         /// lun. | 
|   |  | 76 |  |         /// </remarks> | 
|   | 2552 | 77 |  |         public int Lun { get; } | 
|   |  | 78 |  |  | 
|   |  | 79 |  |         /// <summary> | 
|   |  | 80 |  |         /// Gets the storage account type to be used for the data disk. | 
|   |  | 81 |  |         /// </summary> | 
|   |  | 82 |  |         /// <remarks> | 
|   |  | 83 |  |         /// If omitted, the default is <see cref="Common.StorageAccountType.StandardLrs" />. | 
|   |  | 84 |  |         /// </remarks> | 
|   | 2552 | 85 |  |         public Common.StorageAccountType? StorageAccountType { get; } | 
|   |  | 86 |  |  | 
|   |  | 87 |  |         #endregion // DataDisk | 
|   |  | 88 |  |  | 
|   |  | 89 |  |         #region IPropertyMetadata | 
|   |  | 90 |  |  | 
|   |  | 91 |  |         bool IModifiable.HasBeenModified | 
|   |  | 92 |  |         { | 
|   |  | 93 |  |             //This class is compile time readonly so it cannot have been modified | 
|   | 0 | 94 |  |             get { return false; } | 
|   |  | 95 |  |         } | 
|   |  | 96 |  |  | 
|   |  | 97 |  |         bool IReadOnly.IsReadOnly | 
|   |  | 98 |  |         { | 
|   | 0 | 99 |  |             get { return true; } | 
|   |  | 100 |  |             set | 
|   |  | 101 |  |             { | 
|   |  | 102 |  |                 // This class is compile time readonly already | 
|   | 2891 | 103 |  |             } | 
|   |  | 104 |  |         } | 
|   |  | 105 |  |  | 
|   |  | 106 |  |         #endregion // IPropertyMetadata | 
|   |  | 107 |  |  | 
|   |  | 108 |  |         #region Internal/private methods | 
|   |  | 109 |  |  | 
|   |  | 110 |  |         /// <summary> | 
|   |  | 111 |  |         /// Return a protocol object of the requested type. | 
|   |  | 112 |  |         /// </summary> | 
|   |  | 113 |  |         /// <returns>The protocol object of the requested type.</returns> | 
|   |  | 114 |  |         Models.DataDisk ITransportObjectProvider<Models.DataDisk>.GetTransportObject() | 
|   |  | 115 |  |         { | 
|   | 632 | 116 |  |             Models.DataDisk result = new Models.DataDisk() | 
|   | 632 | 117 |  |             { | 
|   | 632 | 118 |  |                 Caching = UtilitiesInternal.MapNullableEnum<Common.CachingType, Models.CachingType>(this.Caching), | 
|   | 632 | 119 |  |                 DiskSizeGB = this.DiskSizeGB, | 
|   | 632 | 120 |  |                 Lun = this.Lun, | 
|   | 632 | 121 |  |                 StorageAccountType = UtilitiesInternal.MapNullableEnum<Common.StorageAccountType, Models.StorageAccountT | 
|   | 632 | 122 |  |             }; | 
|   |  | 123 |  |  | 
|   | 632 | 124 |  |             return result; | 
|   |  | 125 |  |         } | 
|   |  | 126 |  |  | 
|   |  | 127 |  |         /// <summary> | 
|   |  | 128 |  |         /// Converts a collection of protocol layer objects to object layer collection objects. | 
|   |  | 129 |  |         /// </summary> | 
|   |  | 130 |  |         internal static IList<DataDisk> ConvertFromProtocolCollection(IEnumerable<Models.DataDisk> protoCollection) | 
|   |  | 131 |  |         { | 
|   | 583 | 132 |  |             ConcurrentChangeTrackedModifiableList<DataDisk> converted = UtilitiesInternal.CollectionToThreadSafeCollecti | 
|   | 583 | 133 |  |                 items: protoCollection, | 
|   | 1870 | 134 |  |                 objectCreationFunc: o => new DataDisk(o)); | 
|   |  | 135 |  |  | 
|   | 583 | 136 |  |             return converted; | 
|   |  | 137 |  |         } | 
|   |  | 138 |  |  | 
|   |  | 139 |  |         /// <summary> | 
|   |  | 140 |  |         /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. | 
|   |  | 141 |  |         /// </summary> | 
|   |  | 142 |  |         internal static IList<DataDisk> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.DataDisk> protoCollect | 
|   |  | 143 |  |         { | 
|   | 0 | 144 |  |             ConcurrentChangeTrackedModifiableList<DataDisk> converted = UtilitiesInternal.CollectionToThreadSafeCollecti | 
|   | 0 | 145 |  |                 items: protoCollection, | 
|   | 0 | 146 |  |                 objectCreationFunc: o => new DataDisk(o).Freeze()); | 
|   |  | 147 |  |  | 
|   | 0 | 148 |  |             converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); | 
|   |  | 149 |  |  | 
|   | 0 | 150 |  |             return converted; | 
|   |  | 151 |  |         } | 
|   |  | 152 |  |  | 
|   |  | 153 |  |         /// <summary> | 
|   |  | 154 |  |         /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked  | 
|   |  | 155 |  |         /// and returned as a readonly collection. | 
|   |  | 156 |  |         /// </summary> | 
|   |  | 157 |  |         internal static IReadOnlyList<DataDisk> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.DataDisk> proto | 
|   |  | 158 |  |         { | 
|   | 0 | 159 |  |             IReadOnlyList<DataDisk> converted = | 
|   | 0 | 160 |  |                 UtilitiesInternal.CreateObjectWithNullCheck( | 
|   | 0 | 161 |  |                     UtilitiesInternal.CollectionToNonThreadSafeCollection( | 
|   | 0 | 162 |  |                         items: protoCollection, | 
|   | 0 | 163 |  |                         objectCreationFunc: o => new DataDisk(o).Freeze()), o => o.AsReadOnly()); | 
|   |  | 164 |  |  | 
|   | 0 | 165 |  |             return converted; | 
|   |  | 166 |  |         } | 
|   |  | 167 |  |  | 
|   |  | 168 |  |         #endregion // Internal/private methods | 
|   |  | 169 |  |     } | 
|   |  | 170 |  | } |