| | | 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 when a task completes. |
| | | 22 | | /// </summary> |
| | | 23 | | public partial class ExitConditions : ITransportObjectProvider<Models.ExitConditions>, IPropertyMetadata |
| | | 24 | | { |
| | | 25 | | private class PropertyContainer : PropertyCollection |
| | | 26 | | { |
| | | 27 | | public readonly PropertyAccessor<ExitOptions> DefaultProperty; |
| | | 28 | | public readonly PropertyAccessor<IList<ExitCodeRangeMapping>> ExitCodeRangesProperty; |
| | | 29 | | public readonly PropertyAccessor<IList<ExitCodeMapping>> ExitCodesProperty; |
| | | 30 | | public readonly PropertyAccessor<ExitOptions> FileUploadErrorProperty; |
| | | 31 | | public readonly PropertyAccessor<ExitOptions> PreProcessingErrorProperty; |
| | | 32 | | |
| | 152 | 33 | | public PropertyContainer() : base(BindingState.Unbound) |
| | | 34 | | { |
| | 152 | 35 | | this.DefaultProperty = this.CreatePropertyAccessor<ExitOptions>(nameof(Default), BindingAccess.Read | Bi |
| | 152 | 36 | | this.ExitCodeRangesProperty = this.CreatePropertyAccessor<IList<ExitCodeRangeMapping>>(nameof(ExitCodeRa |
| | 152 | 37 | | this.ExitCodesProperty = this.CreatePropertyAccessor<IList<ExitCodeMapping>>(nameof(ExitCodes), BindingA |
| | 152 | 38 | | this.FileUploadErrorProperty = this.CreatePropertyAccessor<ExitOptions>(nameof(FileUploadError), Binding |
| | 152 | 39 | | this.PreProcessingErrorProperty = this.CreatePropertyAccessor<ExitOptions>(nameof(PreProcessingError), B |
| | 152 | 40 | | } |
| | | 41 | | |
| | 504 | 42 | | public PropertyContainer(Models.ExitConditions protocolObject) : base(BindingState.Bound) |
| | | 43 | | { |
| | 504 | 44 | | this.DefaultProperty = this.CreatePropertyAccessor( |
| | 759 | 45 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.DefaultProperty, o => new ExitOptions(o). |
| | 504 | 46 | | nameof(Default), |
| | 504 | 47 | | BindingAccess.Read); |
| | 504 | 48 | | this.ExitCodeRangesProperty = this.CreatePropertyAccessor( |
| | 504 | 49 | | ExitCodeRangeMapping.ConvertFromProtocolCollectionAndFreeze(protocolObject.ExitCodeRanges), |
| | 504 | 50 | | nameof(ExitCodeRanges), |
| | 504 | 51 | | BindingAccess.Read); |
| | 504 | 52 | | this.ExitCodesProperty = this.CreatePropertyAccessor( |
| | 504 | 53 | | ExitCodeMapping.ConvertFromProtocolCollectionAndFreeze(protocolObject.ExitCodes), |
| | 504 | 54 | | nameof(ExitCodes), |
| | 504 | 55 | | BindingAccess.Read); |
| | 504 | 56 | | this.FileUploadErrorProperty = this.CreatePropertyAccessor( |
| | 763 | 57 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.FileUploadError, o => new ExitOptions(o). |
| | 504 | 58 | | nameof(FileUploadError), |
| | 504 | 59 | | BindingAccess.Read); |
| | 504 | 60 | | this.PreProcessingErrorProperty = this.CreatePropertyAccessor( |
| | 768 | 61 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.PreProcessingError, o => new ExitOptions( |
| | 504 | 62 | | nameof(PreProcessingError), |
| | 504 | 63 | | BindingAccess.Read); |
| | 504 | 64 | | } |
| | | 65 | | } |
| | | 66 | | |
| | | 67 | | private readonly PropertyContainer propertyContainer; |
| | | 68 | | |
| | | 69 | | #region Constructors |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// Initializes a new instance of the <see cref="ExitConditions"/> class. |
| | | 73 | | /// </summary> |
| | 152 | 74 | | public ExitConditions() |
| | | 75 | | { |
| | 152 | 76 | | this.propertyContainer = new PropertyContainer(); |
| | 152 | 77 | | } |
| | | 78 | | |
| | 504 | 79 | | internal ExitConditions(Models.ExitConditions protocolObject) |
| | | 80 | | { |
| | 504 | 81 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| | 504 | 82 | | } |
| | | 83 | | |
| | | 84 | | #endregion Constructors |
| | | 85 | | |
| | | 86 | | #region ExitConditions |
| | | 87 | | |
| | | 88 | | /// <summary> |
| | | 89 | | /// Gets or sets how the Batch service should respond if the task fails with an exit condition not covered by an |
| | | 90 | | /// of the other properties. |
| | | 91 | | /// </summary> |
| | | 92 | | /// <remarks> |
| | | 93 | | /// This value is used if the task exits with any nonzero exit code not listed in the <see cref="ExitCodes"/> or |
| | | 94 | | /// <see cref="ExitCodeRanges"/> collection, with a preprocessing error if the <see cref="PreProcessingError"/> |
| | | 95 | | /// is not present, or with a file upload failure if the <see cref="FileUploadError"/> property is not present. |
| | | 96 | | /// </remarks> |
| | | 97 | | public ExitOptions Default |
| | | 98 | | { |
| | 805 | 99 | | get { return this.propertyContainer.DefaultProperty.Value; } |
| | 148 | 100 | | set { this.propertyContainer.DefaultProperty.Value = value; } |
| | | 101 | | } |
| | | 102 | | |
| | | 103 | | /// <summary> |
| | | 104 | | /// Gets or sets a list of task exit code ranges and how the Batch service should respond to them. |
| | | 105 | | /// </summary> |
| | | 106 | | public IList<ExitCodeRangeMapping> ExitCodeRanges |
| | | 107 | | { |
| | 803 | 108 | | get { return this.propertyContainer.ExitCodeRangesProperty.Value; } |
| | | 109 | | set |
| | | 110 | | { |
| | 83 | 111 | | this.propertyContainer.ExitCodeRangesProperty.Value = ConcurrentChangeTrackedModifiableList<ExitCodeRang |
| | 82 | 112 | | } |
| | | 113 | | } |
| | | 114 | | |
| | | 115 | | /// <summary> |
| | | 116 | | /// Gets or sets a list of task exit codes and how the Batch service should respond to them. |
| | | 117 | | /// </summary> |
| | | 118 | | public IList<ExitCodeMapping> ExitCodes |
| | | 119 | | { |
| | 803 | 120 | | get { return this.propertyContainer.ExitCodesProperty.Value; } |
| | | 121 | | set |
| | | 122 | | { |
| | 83 | 123 | | this.propertyContainer.ExitCodesProperty.Value = ConcurrentChangeTrackedModifiableList<ExitCodeMapping>. |
| | 82 | 124 | | } |
| | | 125 | | } |
| | | 126 | | |
| | | 127 | | /// <summary> |
| | | 128 | | /// Gets or sets how the Batch service should respond if a file upload error occurs. |
| | | 129 | | /// </summary> |
| | | 130 | | /// <remarks> |
| | | 131 | | /// If the task exited with an exit code that was specified via <see cref="ExitCodes" /> or <see cref="ExitCodeR |
| | | 132 | | /// />, and then encountered a file upload error, then the action specified by the exit code takes precedence. |
| | | 133 | | /// </remarks> |
| | | 134 | | public ExitOptions FileUploadError |
| | | 135 | | { |
| | 804 | 136 | | get { return this.propertyContainer.FileUploadErrorProperty.Value; } |
| | 155 | 137 | | set { this.propertyContainer.FileUploadErrorProperty.Value = value; } |
| | | 138 | | } |
| | | 139 | | |
| | | 140 | | /// <summary> |
| | | 141 | | /// Gets or sets how the Batch service should respond if the task fails to start due to an error. |
| | | 142 | | /// </summary> |
| | | 143 | | public ExitOptions PreProcessingError |
| | | 144 | | { |
| | 803 | 145 | | get { return this.propertyContainer.PreProcessingErrorProperty.Value; } |
| | 155 | 146 | | set { this.propertyContainer.PreProcessingErrorProperty.Value = value; } |
| | | 147 | | } |
| | | 148 | | |
| | | 149 | | #endregion // ExitConditions |
| | | 150 | | |
| | | 151 | | #region IPropertyMetadata |
| | | 152 | | |
| | | 153 | | bool IModifiable.HasBeenModified |
| | | 154 | | { |
| | 0 | 155 | | get { return this.propertyContainer.HasBeenModified; } |
| | | 156 | | } |
| | | 157 | | |
| | | 158 | | bool IReadOnly.IsReadOnly |
| | | 159 | | { |
| | 0 | 160 | | get { return this.propertyContainer.IsReadOnly; } |
| | 1012 | 161 | | set { this.propertyContainer.IsReadOnly = value; } |
| | | 162 | | } |
| | | 163 | | |
| | | 164 | | #endregion //IPropertyMetadata |
| | | 165 | | |
| | | 166 | | #region Internal/private methods |
| | | 167 | | /// <summary> |
| | | 168 | | /// Return a protocol object of the requested type. |
| | | 169 | | /// </summary> |
| | | 170 | | /// <returns>The protocol object of the requested type.</returns> |
| | | 171 | | Models.ExitConditions ITransportObjectProvider<Models.ExitConditions>.GetTransportObject() |
| | | 172 | | { |
| | 150 | 173 | | Models.ExitConditions result = new Models.ExitConditions() |
| | 150 | 174 | | { |
| | 223 | 175 | | DefaultProperty = UtilitiesInternal.CreateObjectWithNullCheck(this.Default, (o) => o.GetTransportObject( |
| | 150 | 176 | | ExitCodeRanges = UtilitiesInternal.ConvertToProtocolCollection(this.ExitCodeRanges), |
| | 150 | 177 | | ExitCodes = UtilitiesInternal.ConvertToProtocolCollection(this.ExitCodes), |
| | 227 | 178 | | FileUploadError = UtilitiesInternal.CreateObjectWithNullCheck(this.FileUploadError, (o) => o.GetTranspor |
| | 227 | 179 | | PreProcessingError = UtilitiesInternal.CreateObjectWithNullCheck(this.PreProcessingError, (o) => o.GetTr |
| | 150 | 180 | | }; |
| | | 181 | | |
| | 150 | 182 | | return result; |
| | | 183 | | } |
| | | 184 | | |
| | | 185 | | /// <summary> |
| | | 186 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | | 187 | | /// </summary> |
| | | 188 | | internal static IList<ExitConditions> ConvertFromProtocolCollection(IEnumerable<Models.ExitConditions> protoColl |
| | | 189 | | { |
| | 0 | 190 | | ConcurrentChangeTrackedModifiableList<ExitConditions> converted = UtilitiesInternal.CollectionToThreadSafeCo |
| | 0 | 191 | | items: protoCollection, |
| | 0 | 192 | | objectCreationFunc: o => new ExitConditions(o)); |
| | | 193 | | |
| | 0 | 194 | | return converted; |
| | | 195 | | } |
| | | 196 | | |
| | | 197 | | /// <summary> |
| | | 198 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | | 199 | | /// </summary> |
| | | 200 | | internal static IList<ExitConditions> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.ExitConditions> |
| | | 201 | | { |
| | 0 | 202 | | ConcurrentChangeTrackedModifiableList<ExitConditions> converted = UtilitiesInternal.CollectionToThreadSafeCo |
| | 0 | 203 | | items: protoCollection, |
| | 0 | 204 | | objectCreationFunc: o => new ExitConditions(o).Freeze()); |
| | | 205 | | |
| | 0 | 206 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | | 207 | | |
| | 0 | 208 | | return converted; |
| | | 209 | | } |
| | | 210 | | |
| | | 211 | | /// <summary> |
| | | 212 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | | 213 | | /// and returned as a readonly collection. |
| | | 214 | | /// </summary> |
| | | 215 | | internal static IReadOnlyList<ExitConditions> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.ExitCondi |
| | | 216 | | { |
| | 0 | 217 | | IReadOnlyList<ExitConditions> converted = |
| | 0 | 218 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| | 0 | 219 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| | 0 | 220 | | items: protoCollection, |
| | 0 | 221 | | objectCreationFunc: o => new ExitConditions(o).Freeze()), o => o.AsReadOnly()); |
| | | 222 | | |
| | 0 | 223 | | return converted; |
| | | 224 | | } |
| | | 225 | | |
| | | 226 | | #endregion // Internal/private methods |
| | | 227 | | } |
| | | 228 | | } |