| | 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 | | /// An environment variable to be set on a task process, such as a job task, start task, job manager task, or job pr |
| | 22 | | /// or release task. |
| | 23 | | /// </summary> |
| | 24 | | public partial class EnvironmentSetting : ITransportObjectProvider<Models.EnvironmentSetting>, IPropertyMetadata |
| | 25 | | { |
| | 26 | | #region Constructors |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the <see cref="EnvironmentSetting"/> class. |
| | 29 | | /// </summary> |
| | 30 | | /// <param name='name'>The name of the environment variable.</param> |
| | 31 | | /// <param name='value'>The value of the environment variable.</param> |
| 2783 | 32 | | public EnvironmentSetting( |
| 2783 | 33 | | string name, |
| 2783 | 34 | | string value) |
| | 35 | | { |
| 2783 | 36 | | this.Name = name; |
| 2783 | 37 | | this.Value = value; |
| 2783 | 38 | | } |
| | 39 | |
|
| 12867 | 40 | | internal EnvironmentSetting(Models.EnvironmentSetting protocolObject) |
| | 41 | | { |
| 12867 | 42 | | this.Name = protocolObject.Name; |
| 12867 | 43 | | this.Value = protocolObject.Value; |
| 12867 | 44 | | } |
| | 45 | |
|
| | 46 | | #endregion Constructors |
| | 47 | |
|
| | 48 | | #region EnvironmentSetting |
| | 49 | |
|
| | 50 | | /// <summary> |
| | 51 | | /// Gets the name of the environment variable. |
| | 52 | | /// </summary> |
| 18432 | 53 | | public string Name { get; } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// Gets the value of the environment variable. |
| | 57 | | /// </summary> |
| 18432 | 58 | | public string Value { get; } |
| | 59 | |
|
| | 60 | | #endregion // EnvironmentSetting |
| | 61 | |
|
| | 62 | | #region IPropertyMetadata |
| | 63 | |
|
| | 64 | | bool IModifiable.HasBeenModified |
| | 65 | | { |
| | 66 | | //This class is compile time readonly so it cannot have been modified |
| 0 | 67 | | get { return false; } |
| | 68 | | } |
| | 69 | |
|
| | 70 | | bool IReadOnly.IsReadOnly |
| | 71 | | { |
| 0 | 72 | | get { return true; } |
| | 73 | | set |
| | 74 | | { |
| | 75 | | // This class is compile time readonly already |
| 28635 | 76 | | } |
| | 77 | | } |
| | 78 | |
|
| | 79 | | #endregion // IPropertyMetadata |
| | 80 | |
|
| | 81 | | #region Internal/private methods |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Return a protocol object of the requested type. |
| | 85 | | /// </summary> |
| | 86 | | /// <returns>The protocol object of the requested type.</returns> |
| | 87 | | Models.EnvironmentSetting ITransportObjectProvider<Models.EnvironmentSetting>.GetTransportObject() |
| | 88 | | { |
| 2782 | 89 | | Models.EnvironmentSetting result = new Models.EnvironmentSetting() |
| 2782 | 90 | | { |
| 2782 | 91 | | Name = this.Name, |
| 2782 | 92 | | Value = this.Value, |
| 2782 | 93 | | }; |
| | 94 | |
|
| 2782 | 95 | | return result; |
| | 96 | | } |
| | 97 | |
|
| | 98 | | /// <summary> |
| | 99 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | 100 | | /// </summary> |
| | 101 | | internal static IList<EnvironmentSetting> ConvertFromProtocolCollection(IEnumerable<Models.EnvironmentSetting> p |
| | 102 | | { |
| 3804 | 103 | | ConcurrentChangeTrackedModifiableList<EnvironmentSetting> converted = UtilitiesInternal.CollectionToThreadSa |
| 3804 | 104 | | items: protoCollection, |
| 12373 | 105 | | objectCreationFunc: o => new EnvironmentSetting(o)); |
| | 106 | |
|
| 3804 | 107 | | return converted; |
| | 108 | | } |
| | 109 | |
|
| | 110 | | /// <summary> |
| | 111 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | 112 | | /// </summary> |
| | 113 | | internal static IList<EnvironmentSetting> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.EnvironmentS |
| | 114 | | { |
| 2037 | 115 | | ConcurrentChangeTrackedModifiableList<EnvironmentSetting> converted = UtilitiesInternal.CollectionToThreadSa |
| 2037 | 116 | | items: protoCollection, |
| 6335 | 117 | | objectCreationFunc: o => new EnvironmentSetting(o).Freeze()); |
| | 118 | |
|
| 3010 | 119 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | 120 | |
|
| 2037 | 121 | | return converted; |
| | 122 | | } |
| | 123 | |
|
| | 124 | | /// <summary> |
| | 125 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | 126 | | /// and returned as a readonly collection. |
| | 127 | | /// </summary> |
| | 128 | | internal static IReadOnlyList<EnvironmentSetting> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.Envir |
| | 129 | | { |
| 0 | 130 | | IReadOnlyList<EnvironmentSetting> converted = |
| 0 | 131 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| 0 | 132 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| 0 | 133 | | items: protoCollection, |
| 0 | 134 | | objectCreationFunc: o => new EnvironmentSetting(o).Freeze()), o => o.AsReadOnly()); |
| | 135 | |
|
| 0 | 136 | | return converted; |
| | 137 | | } |
| | 138 | |
|
| | 139 | | #endregion // Internal/private methods |
| | 140 | | } |
| | 141 | | } |