| | | 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 | | /// A range of exit codes and how the Batch service should respond if a task exits with an exit code within that ran |
| | | 22 | | /// </summary> |
| | | 23 | | public partial class ExitCodeRangeMapping : ITransportObjectProvider<Models.ExitCodeRangeMapping>, IPropertyMetadata |
| | | 24 | | { |
| | | 25 | | #region Constructors |
| | | 26 | | /// <summary> |
| | | 27 | | /// Initializes a new instance of the <see cref="ExitCodeRangeMapping"/> class. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name='start'>The first exit code in the range.</param> |
| | | 30 | | /// <param name='end'>The last exit code in the range.</param> |
| | | 31 | | /// <param name='exitOptions'>An <see cref="ExitOptions" /> specifying how the Batch service should respond if t |
| | | 32 | | /// code in the range <see cref="Start"/> to <see cref="End"/> inclusive.</param> |
| | 482 | 33 | | public ExitCodeRangeMapping( |
| | 482 | 34 | | int start, |
| | 482 | 35 | | int end, |
| | 482 | 36 | | ExitOptions exitOptions) |
| | | 37 | | { |
| | 482 | 38 | | this.Start = start; |
| | 482 | 39 | | this.End = end; |
| | 482 | 40 | | this.ExitOptions = exitOptions; |
| | 482 | 41 | | } |
| | | 42 | | |
| | 1187 | 43 | | internal ExitCodeRangeMapping(Models.ExitCodeRangeMapping protocolObject) |
| | | 44 | | { |
| | 1187 | 45 | | this.End = protocolObject.End; |
| | 1788 | 46 | | this.ExitOptions = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ExitOptions, o => new ExitOpti |
| | 1187 | 47 | | this.Start = protocolObject.Start; |
| | 1187 | 48 | | } |
| | | 49 | | |
| | | 50 | | #endregion Constructors |
| | | 51 | | |
| | | 52 | | #region ExitCodeRangeMapping |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// Gets the last exit code in the range. |
| | | 56 | | /// </summary> |
| | | 57 | | /// <remarks> |
| | | 58 | | /// Ranges are inclusive. For example, if an <see cref="ExitCodeRangeMapping" /> specifies Start 8 and End 10, t |
| | | 59 | | /// it matches exit codes 8, 9 and 10. |
| | | 60 | | /// </remarks> |
| | 2148 | 61 | | public int End { get; } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// Gets an <see cref="ExitOptions" /> specifying how the Batch service should respond if the task exits with an |
| | | 65 | | /// exit code in the range <see cref="Start"/> to <see cref="End"/> inclusive. |
| | | 66 | | /// </summary> |
| | 2148 | 67 | | public ExitOptions ExitOptions { get; } |
| | | 68 | | |
| | | 69 | | /// <summary> |
| | | 70 | | /// Gets the first exit code in the range. |
| | | 71 | | /// </summary> |
| | | 72 | | /// <remarks> |
| | | 73 | | /// Ranges are inclusive. For example, if an <see cref="ExitCodeRangeMapping" /> specifies Start 8 and End 10, t |
| | | 74 | | /// it matches exit codes 8, 9 and 10. |
| | | 75 | | /// </remarks> |
| | 2148 | 76 | | public int Start { get; } |
| | | 77 | | |
| | | 78 | | #endregion // ExitCodeRangeMapping |
| | | 79 | | |
| | | 80 | | #region IPropertyMetadata |
| | | 81 | | |
| | | 82 | | bool IModifiable.HasBeenModified |
| | | 83 | | { |
| | | 84 | | //This class is compile time readonly so it cannot have been modified |
| | 0 | 85 | | get { return false; } |
| | | 86 | | } |
| | | 87 | | |
| | | 88 | | bool IReadOnly.IsReadOnly |
| | | 89 | | { |
| | 0 | 90 | | get { return true; } |
| | | 91 | | set |
| | | 92 | | { |
| | | 93 | | // This class is compile time readonly already |
| | 5131 | 94 | | } |
| | | 95 | | } |
| | | 96 | | |
| | | 97 | | #endregion // IPropertyMetadata |
| | | 98 | | |
| | | 99 | | #region Internal/private methods |
| | | 100 | | |
| | | 101 | | /// <summary> |
| | | 102 | | /// Return a protocol object of the requested type. |
| | | 103 | | /// </summary> |
| | | 104 | | /// <returns>The protocol object of the requested type.</returns> |
| | | 105 | | Models.ExitCodeRangeMapping ITransportObjectProvider<Models.ExitCodeRangeMapping>.GetTransportObject() |
| | | 106 | | { |
| | 481 | 107 | | Models.ExitCodeRangeMapping result = new Models.ExitCodeRangeMapping() |
| | 481 | 108 | | { |
| | 481 | 109 | | End = this.End, |
| | 962 | 110 | | ExitOptions = UtilitiesInternal.CreateObjectWithNullCheck(this.ExitOptions, (o) => o.GetTransportObject( |
| | 481 | 111 | | Start = this.Start, |
| | 481 | 112 | | }; |
| | | 113 | | |
| | 481 | 114 | | return result; |
| | | 115 | | } |
| | | 116 | | |
| | | 117 | | /// <summary> |
| | | 118 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | | 119 | | /// </summary> |
| | | 120 | | internal static IList<ExitCodeRangeMapping> ConvertFromProtocolCollection(IEnumerable<Models.ExitCodeRangeMappin |
| | | 121 | | { |
| | 0 | 122 | | ConcurrentChangeTrackedModifiableList<ExitCodeRangeMapping> converted = UtilitiesInternal.CollectionToThread |
| | 0 | 123 | | items: protoCollection, |
| | 0 | 124 | | objectCreationFunc: o => new ExitCodeRangeMapping(o)); |
| | | 125 | | |
| | 0 | 126 | | return converted; |
| | | 127 | | } |
| | | 128 | | |
| | | 129 | | /// <summary> |
| | | 130 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | | 131 | | /// </summary> |
| | | 132 | | internal static IList<ExitCodeRangeMapping> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.ExitCodeRa |
| | | 133 | | { |
| | 504 | 134 | | ConcurrentChangeTrackedModifiableList<ExitCodeRangeMapping> converted = UtilitiesInternal.CollectionToThread |
| | 504 | 135 | | items: protoCollection, |
| | 1691 | 136 | | objectCreationFunc: o => new ExitCodeRangeMapping(o).Freeze()); |
| | | 137 | | |
| | 758 | 138 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | | 139 | | |
| | 504 | 140 | | return converted; |
| | | 141 | | } |
| | | 142 | | |
| | | 143 | | /// <summary> |
| | | 144 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | | 145 | | /// and returned as a readonly collection. |
| | | 146 | | /// </summary> |
| | | 147 | | internal static IReadOnlyList<ExitCodeRangeMapping> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.Exi |
| | | 148 | | { |
| | 0 | 149 | | IReadOnlyList<ExitCodeRangeMapping> converted = |
| | 0 | 150 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| | 0 | 151 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| | 0 | 152 | | items: protoCollection, |
| | 0 | 153 | | objectCreationFunc: o => new ExitCodeRangeMapping(o).Freeze()), o => o.AsReadOnly()); |
| | | 154 | | |
| | 0 | 155 | | return converted; |
| | | 156 | | } |
| | | 157 | | |
| | | 158 | | #endregion // Internal/private methods |
| | | 159 | | } |
| | | 160 | | } |