| | 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 process exit code and how the Batch service should respond if a task exits with that exit code. |
| | 22 | | /// </summary> |
| | 23 | | public partial class ExitCodeMapping : ITransportObjectProvider<Models.ExitCodeMapping>, IPropertyMetadata |
| | 24 | | { |
| | 25 | | #region Constructors |
| | 26 | | /// <summary> |
| | 27 | | /// Initializes a new instance of the <see cref="ExitCodeMapping"/> class. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name='code'>The process exit code.</param> |
| | 30 | | /// <param name='exitOptions'>How the Batch service should respond if the task exits with this exit code.</param |
| 451 | 31 | | public ExitCodeMapping( |
| 451 | 32 | | int code, |
| 451 | 33 | | ExitOptions exitOptions) |
| | 34 | | { |
| 451 | 35 | | this.Code = code; |
| 451 | 36 | | this.ExitOptions = exitOptions; |
| 451 | 37 | | } |
| | 38 | |
|
| 1220 | 39 | | internal ExitCodeMapping(Models.ExitCodeMapping protocolObject) |
| | 40 | | { |
| 1220 | 41 | | this.Code = protocolObject.Code; |
| 1785 | 42 | | this.ExitOptions = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ExitOptions, o => new ExitOpti |
| 1220 | 43 | | } |
| | 44 | |
|
| | 45 | | #endregion Constructors |
| | 46 | |
|
| | 47 | | #region ExitCodeMapping |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// Gets the process exit code. |
| | 51 | | /// </summary> |
| 2119 | 52 | | public int Code { get; } |
| | 53 | |
|
| | 54 | | /// <summary> |
| | 55 | | /// Gets how the Batch service should respond if the task exits with this exit code. |
| | 56 | | /// </summary> |
| 2119 | 57 | | public ExitOptions ExitOptions { get; } |
| | 58 | |
|
| | 59 | | #endregion // ExitCodeMapping |
| | 60 | |
|
| | 61 | | #region IPropertyMetadata |
| | 62 | |
|
| | 63 | | bool IModifiable.HasBeenModified |
| | 64 | | { |
| | 65 | | //This class is compile time readonly so it cannot have been modified |
| 0 | 66 | | get { return false; } |
| | 67 | | } |
| | 68 | |
|
| | 69 | | bool IReadOnly.IsReadOnly |
| | 70 | | { |
| 0 | 71 | | get { return true; } |
| | 72 | | set |
| | 73 | | { |
| | 74 | | // This class is compile time readonly already |
| 5232 | 75 | | } |
| | 76 | | } |
| | 77 | |
|
| | 78 | | #endregion // IPropertyMetadata |
| | 79 | |
|
| | 80 | | #region Internal/private methods |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Return a protocol object of the requested type. |
| | 84 | | /// </summary> |
| | 85 | | /// <returns>The protocol object of the requested type.</returns> |
| | 86 | | Models.ExitCodeMapping ITransportObjectProvider<Models.ExitCodeMapping>.GetTransportObject() |
| | 87 | | { |
| 450 | 88 | | Models.ExitCodeMapping result = new Models.ExitCodeMapping() |
| 450 | 89 | | { |
| 450 | 90 | | Code = this.Code, |
| 900 | 91 | | ExitOptions = UtilitiesInternal.CreateObjectWithNullCheck(this.ExitOptions, (o) => o.GetTransportObject( |
| 450 | 92 | | }; |
| | 93 | |
|
| 450 | 94 | | return result; |
| | 95 | | } |
| | 96 | |
|
| | 97 | | /// <summary> |
| | 98 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | 99 | | /// </summary> |
| | 100 | | internal static IList<ExitCodeMapping> ConvertFromProtocolCollection(IEnumerable<Models.ExitCodeMapping> protoCo |
| | 101 | | { |
| 0 | 102 | | ConcurrentChangeTrackedModifiableList<ExitCodeMapping> converted = UtilitiesInternal.CollectionToThreadSafeC |
| 0 | 103 | | items: protoCollection, |
| 0 | 104 | | objectCreationFunc: o => new ExitCodeMapping(o)); |
| | 105 | |
|
| 0 | 106 | | return converted; |
| | 107 | | } |
| | 108 | |
|
| | 109 | | /// <summary> |
| | 110 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | 111 | | /// </summary> |
| | 112 | | internal static IList<ExitCodeMapping> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.ExitCodeMapping |
| | 113 | | { |
| 504 | 114 | | ConcurrentChangeTrackedModifiableList<ExitCodeMapping> converted = UtilitiesInternal.CollectionToThreadSafeC |
| 504 | 115 | | items: protoCollection, |
| 1724 | 116 | | objectCreationFunc: o => new ExitCodeMapping(o).Freeze()); |
| | 117 | |
|
| 771 | 118 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | 119 | |
|
| 504 | 120 | | return converted; |
| | 121 | | } |
| | 122 | |
|
| | 123 | | /// <summary> |
| | 124 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | 125 | | /// and returned as a readonly collection. |
| | 126 | | /// </summary> |
| | 127 | | internal static IReadOnlyList<ExitCodeMapping> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.ExitCode |
| | 128 | | { |
| 0 | 129 | | IReadOnlyList<ExitCodeMapping> converted = |
| 0 | 130 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| 0 | 131 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| 0 | 132 | | items: protoCollection, |
| 0 | 133 | | objectCreationFunc: o => new ExitCodeMapping(o).Freeze()), o => o.AsReadOnly()); |
| | 134 | |
|
| 0 | 135 | | return converted; |
| | 136 | | } |
| | 137 | |
|
| | 138 | | #endregion // Internal/private methods |
| | 139 | | } |
| | 140 | | } |