| | 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 | | /// How the Batch service should respond to a particular exit condition. |
| | 22 | | /// </summary> |
| | 23 | | public partial class ExitOptions : ITransportObjectProvider<Models.ExitOptions>, IPropertyMetadata |
| | 24 | | { |
| | 25 | | private class PropertyContainer : PropertyCollection |
| | 26 | | { |
| | 27 | | public readonly PropertyAccessor<Common.DependencyAction?> DependencyActionProperty; |
| | 28 | | public readonly PropertyAccessor<Common.JobAction?> JobActionProperty; |
| | 29 | |
|
| 1262 | 30 | | public PropertyContainer() : base(BindingState.Unbound) |
| | 31 | | { |
| 1262 | 32 | | this.DependencyActionProperty = this.CreatePropertyAccessor<Common.DependencyAction?>(nameof(DependencyA |
| 1262 | 33 | | this.JobActionProperty = this.CreatePropertyAccessor<Common.JobAction?>(nameof(JobAction), BindingAccess |
| 1262 | 34 | | } |
| | 35 | |
|
| 1944 | 36 | | public PropertyContainer(Models.ExitOptions protocolObject) : base(BindingState.Bound) |
| | 37 | | { |
| 1944 | 38 | | this.DependencyActionProperty = this.CreatePropertyAccessor( |
| 1944 | 39 | | UtilitiesInternal.MapNullableEnum<Models.DependencyAction, Common.DependencyAction>(protocolObject.D |
| 1944 | 40 | | nameof(DependencyAction), |
| 1944 | 41 | | BindingAccess.Read); |
| 1944 | 42 | | this.JobActionProperty = this.CreatePropertyAccessor( |
| 1944 | 43 | | UtilitiesInternal.MapNullableEnum<Models.JobAction, Common.JobAction>(protocolObject.JobAction), |
| 1944 | 44 | | nameof(JobAction), |
| 1944 | 45 | | BindingAccess.Read); |
| 1944 | 46 | | } |
| | 47 | | } |
| | 48 | |
|
| | 49 | | private readonly PropertyContainer propertyContainer; |
| | 50 | |
|
| | 51 | | #region Constructors |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// Initializes a new instance of the <see cref="ExitOptions"/> class. |
| | 55 | | /// </summary> |
| 1262 | 56 | | public ExitOptions() |
| | 57 | | { |
| 1262 | 58 | | this.propertyContainer = new PropertyContainer(); |
| 1262 | 59 | | } |
| | 60 | |
|
| 1944 | 61 | | internal ExitOptions(Models.ExitOptions protocolObject) |
| | 62 | | { |
| 1944 | 63 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| 1944 | 64 | | } |
| | 65 | |
|
| | 66 | | #endregion Constructors |
| | 67 | |
|
| | 68 | | #region ExitOptions |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets or sets an action that the Batch service should take on tasks that depend on this task. |
| | 72 | | /// </summary> |
| | 73 | | /// <remarks> |
| | 74 | | /// The default is <see cref="Common.DependencyAction.Satisfy"/> for exit code 0, and <see cref="Common.Dependen |
| | 75 | | /// for all other exit conditions. If the job's <see cref="CloudJob.UsesTaskDependencies"/> is false, you cannot |
| | 76 | | /// add a task with this property set. |
| | 77 | | /// </remarks> |
| | 78 | | public Common.DependencyAction? DependencyAction |
| | 79 | | { |
| 4453 | 80 | | get { return this.propertyContainer.DependencyActionProperty.Value; } |
| 1235 | 81 | | set { this.propertyContainer.DependencyActionProperty.Value = value; } |
| | 82 | | } |
| | 83 | |
|
| | 84 | | /// <summary> |
| | 85 | | /// Gets or sets an action to take on the job containing the task, if the task completes with the given exit con |
| | 86 | | /// and the job's <see cref="CloudJob.OnTaskFailure"/> property is <see cref="Common.OnTaskFailure.PerformExitOp |
| | 87 | | /// </summary> |
| | 88 | | public Common.JobAction? JobAction |
| | 89 | | { |
| 4452 | 90 | | get { return this.propertyContainer.JobActionProperty.Value; } |
| 1295 | 91 | | set { this.propertyContainer.JobActionProperty.Value = value; } |
| | 92 | | } |
| | 93 | |
|
| | 94 | | #endregion // ExitOptions |
| | 95 | |
|
| | 96 | | #region IPropertyMetadata |
| | 97 | |
|
| | 98 | | bool IModifiable.HasBeenModified |
| | 99 | | { |
| 0 | 100 | | get { return this.propertyContainer.HasBeenModified; } |
| | 101 | | } |
| | 102 | |
|
| | 103 | | bool IReadOnly.IsReadOnly |
| | 104 | | { |
| 0 | 105 | | get { return this.propertyContainer.IsReadOnly; } |
| 5452 | 106 | | set { this.propertyContainer.IsReadOnly = value; } |
| | 107 | | } |
| | 108 | |
|
| | 109 | | #endregion //IPropertyMetadata |
| | 110 | |
|
| | 111 | | #region Internal/private methods |
| | 112 | | /// <summary> |
| | 113 | | /// Return a protocol object of the requested type. |
| | 114 | | /// </summary> |
| | 115 | | /// <returns>The protocol object of the requested type.</returns> |
| | 116 | | Models.ExitOptions ITransportObjectProvider<Models.ExitOptions>.GetTransportObject() |
| | 117 | | { |
| 1258 | 118 | | Models.ExitOptions result = new Models.ExitOptions() |
| 1258 | 119 | | { |
| 1258 | 120 | | DependencyAction = UtilitiesInternal.MapNullableEnum<Common.DependencyAction, Models.DependencyAction>(t |
| 1258 | 121 | | JobAction = UtilitiesInternal.MapNullableEnum<Common.JobAction, Models.JobAction>(this.JobAction), |
| 1258 | 122 | | }; |
| | 123 | |
|
| 1258 | 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<ExitOptions> ConvertFromProtocolCollection(IEnumerable<Models.ExitOptions> protoCollection |
| | 131 | | { |
| 0 | 132 | | ConcurrentChangeTrackedModifiableList<ExitOptions> converted = UtilitiesInternal.CollectionToThreadSafeColle |
| 0 | 133 | | items: protoCollection, |
| 0 | 134 | | objectCreationFunc: o => new ExitOptions(o)); |
| | 135 | |
|
| 0 | 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<ExitOptions> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.ExitOptions> protoC |
| | 143 | | { |
| 0 | 144 | | ConcurrentChangeTrackedModifiableList<ExitOptions> converted = UtilitiesInternal.CollectionToThreadSafeColle |
| 0 | 145 | | items: protoCollection, |
| 0 | 146 | | objectCreationFunc: o => new ExitOptions(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<ExitOptions> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.ExitOptions> |
| | 158 | | { |
| 0 | 159 | | IReadOnlyList<ExitOptions> converted = |
| 0 | 160 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| 0 | 161 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| 0 | 162 | | items: protoCollection, |
| 0 | 163 | | objectCreationFunc: o => new ExitOptions(o).Freeze()), o => o.AsReadOnly()); |
| | 164 | |
|
| 0 | 165 | | return converted; |
| | 166 | | } |
| | 167 | |
|
| | 168 | | #endregion // Internal/private methods |
| | 169 | | } |
| | 170 | | } |