| | 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 |
| 146 | 14 | | { |
| | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| 146 | 16 | | using System; |
| | 17 | | using System.Collections.Generic; |
| | 18 | | using System.Linq; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// The <see cref="CloudJobSchedule.JobSpecification"/> of a <see cref="CloudJobSchedule"/>. |
| | 22 | | /// </summary> |
| | 23 | | public partial class JobSpecification : ITransportObjectProvider<Models.JobSpecification>, IPropertyMetadata |
| | 24 | | { |
| | 25 | | private class PropertyContainer : PropertyCollection |
| | 26 | | { |
| | 27 | | public readonly PropertyAccessor<IList<EnvironmentSetting>> CommonEnvironmentSettingsProperty; |
| | 28 | | public readonly PropertyAccessor<JobConstraints> ConstraintsProperty; |
| | 29 | | public readonly PropertyAccessor<string> DisplayNameProperty; |
| | 30 | | public readonly PropertyAccessor<JobManagerTask> JobManagerTaskProperty; |
| | 31 | | public readonly PropertyAccessor<JobPreparationTask> JobPreparationTaskProperty; |
| | 32 | | public readonly PropertyAccessor<JobReleaseTask> JobReleaseTaskProperty; |
| | 33 | | public readonly PropertyAccessor<IList<MetadataItem>> MetadataProperty; |
| | 34 | | public readonly PropertyAccessor<JobNetworkConfiguration> NetworkConfigurationProperty; |
| | 35 | | public readonly PropertyAccessor<Common.OnAllTasksComplete?> OnAllTasksCompleteProperty; |
| | 36 | | public readonly PropertyAccessor<Common.OnTaskFailure?> OnTaskFailureProperty; |
| | 37 | | public readonly PropertyAccessor<PoolInformation> PoolInformationProperty; |
| | 38 | | public readonly PropertyAccessor<int?> PriorityProperty; |
| | 39 | | public readonly PropertyAccessor<bool?> UsesTaskDependenciesProperty; |
| | 40 | |
|
| 147 | 41 | | public PropertyContainer() : base(BindingState.Unbound) |
| | 42 | | { |
| 147 | 43 | | this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor<IList<EnvironmentSetting>>(nameof(C |
| 147 | 44 | | this.ConstraintsProperty = this.CreatePropertyAccessor<JobConstraints>(nameof(Constraints), BindingAcces |
| 147 | 45 | | this.DisplayNameProperty = this.CreatePropertyAccessor<string>(nameof(DisplayName), BindingAccess.Read | |
| 147 | 46 | | this.JobManagerTaskProperty = this.CreatePropertyAccessor<JobManagerTask>(nameof(JobManagerTask), Bindin |
| 147 | 47 | | this.JobPreparationTaskProperty = this.CreatePropertyAccessor<JobPreparationTask>(nameof(JobPreparationT |
| 147 | 48 | | this.JobReleaseTaskProperty = this.CreatePropertyAccessor<JobReleaseTask>(nameof(JobReleaseTask), Bindin |
| 147 | 49 | | this.MetadataProperty = this.CreatePropertyAccessor<IList<MetadataItem>>(nameof(Metadata), BindingAccess |
| 147 | 50 | | this.NetworkConfigurationProperty = this.CreatePropertyAccessor<JobNetworkConfiguration>(nameof(NetworkC |
| 147 | 51 | | this.OnAllTasksCompleteProperty = this.CreatePropertyAccessor<Common.OnAllTasksComplete?>(nameof(OnAllTa |
| 147 | 52 | | this.OnTaskFailureProperty = this.CreatePropertyAccessor<Common.OnTaskFailure?>(nameof(OnTaskFailure), B |
| 147 | 53 | | this.PoolInformationProperty = this.CreatePropertyAccessor<PoolInformation>(nameof(PoolInformation), Bin |
| 147 | 54 | | this.PriorityProperty = this.CreatePropertyAccessor<int?>(nameof(Priority), BindingAccess.Read | Binding |
| 147 | 55 | | this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor<bool?>(nameof(UsesTaskDependencies), Bin |
| 147 | 56 | | } |
| | 57 | |
|
| 486 | 58 | | public PropertyContainer(Models.JobSpecification protocolObject) : base(BindingState.Bound) |
| | 59 | | { |
| 486 | 60 | | this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor( |
| 486 | 61 | | EnvironmentSetting.ConvertFromProtocolCollection(protocolObject.CommonEnvironmentSettings), |
| 486 | 62 | | nameof(CommonEnvironmentSettings), |
| 486 | 63 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 64 | | this.ConstraintsProperty = this.CreatePropertyAccessor( |
| 735 | 65 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Constraints, o => new JobConstraints(o)), |
| 486 | 66 | | nameof(Constraints), |
| 486 | 67 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 68 | | this.DisplayNameProperty = this.CreatePropertyAccessor( |
| 486 | 69 | | protocolObject.DisplayName, |
| 486 | 70 | | nameof(DisplayName), |
| 486 | 71 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 72 | | this.JobManagerTaskProperty = this.CreatePropertyAccessor( |
| 700 | 73 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobManagerTask, o => new JobManagerTask(o |
| 486 | 74 | | nameof(JobManagerTask), |
| 486 | 75 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 76 | | this.JobPreparationTaskProperty = this.CreatePropertyAccessor( |
| 729 | 77 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobPreparationTask, o => new JobPreparati |
| 486 | 78 | | nameof(JobPreparationTask), |
| 486 | 79 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 80 | | this.JobReleaseTaskProperty = this.CreatePropertyAccessor( |
| 734 | 81 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobReleaseTask, o => new JobReleaseTask(o |
| 486 | 82 | | nameof(JobReleaseTask), |
| 486 | 83 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 84 | | this.MetadataProperty = this.CreatePropertyAccessor( |
| 486 | 85 | | MetadataItem.ConvertFromProtocolCollection(protocolObject.Metadata), |
| 486 | 86 | | nameof(Metadata), |
| 486 | 87 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 88 | | this.NetworkConfigurationProperty = this.CreatePropertyAccessor( |
| 729 | 89 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.NetworkConfiguration, o => new JobNetwork |
| 486 | 90 | | nameof(NetworkConfiguration), |
| 486 | 91 | | BindingAccess.Read); |
| 486 | 92 | | this.OnAllTasksCompleteProperty = this.CreatePropertyAccessor( |
| 486 | 93 | | UtilitiesInternal.MapNullableEnum<Models.OnAllTasksComplete, Common.OnAllTasksComplete>(protocolObje |
| 486 | 94 | | nameof(OnAllTasksComplete), |
| 486 | 95 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 96 | | this.OnTaskFailureProperty = this.CreatePropertyAccessor( |
| 486 | 97 | | UtilitiesInternal.MapNullableEnum<Models.OnTaskFailure, Common.OnTaskFailure>(protocolObject.OnTaskF |
| 486 | 98 | | nameof(OnTaskFailure), |
| 486 | 99 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 100 | | this.PoolInformationProperty = this.CreatePropertyAccessor( |
| 972 | 101 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.PoolInfo, o => new PoolInformation(o)), |
| 486 | 102 | | nameof(PoolInformation), |
| 486 | 103 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 104 | | this.PriorityProperty = this.CreatePropertyAccessor( |
| 486 | 105 | | protocolObject.Priority, |
| 486 | 106 | | nameof(Priority), |
| 486 | 107 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 108 | | this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor( |
| 486 | 109 | | protocolObject.UsesTaskDependencies, |
| 486 | 110 | | nameof(UsesTaskDependencies), |
| 486 | 111 | | BindingAccess.Read | BindingAccess.Write); |
| 486 | 112 | | } |
| | 113 | | } |
| | 114 | |
|
| | 115 | | private readonly PropertyContainer propertyContainer; |
| | 116 | |
|
| | 117 | | #region Constructors |
| | 118 | |
|
| | 119 | | /// <summary> |
| | 120 | | /// Initializes a new instance of the <see cref="JobSpecification"/> class. |
| | 121 | | /// </summary> |
| | 122 | | /// <param name='poolInformation'>The pool on which the Batch service runs the tasks of jobs created via this <s |
| 147 | 123 | | public JobSpecification( |
| 147 | 124 | | PoolInformation poolInformation) |
| | 125 | | { |
| 147 | 126 | | this.propertyContainer = new PropertyContainer(); |
| 147 | 127 | | this.PoolInformation = poolInformation; |
| 147 | 128 | | } |
| | 129 | |
|
| 486 | 130 | | internal JobSpecification(Models.JobSpecification protocolObject) |
| | 131 | | { |
| 486 | 132 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| 486 | 133 | | } |
| | 134 | |
|
| | 135 | | #endregion Constructors |
| | 136 | |
|
| | 137 | | #region JobSpecification |
| | 138 | |
|
| | 139 | | /// <summary> |
| | 140 | | /// Gets or sets a list of common environment variable settings. |
| | 141 | | /// </summary> |
| | 142 | | /// <remarks> |
| | 143 | | /// These environment variables are set for all tasks in jobs created under this <see cref="CloudJobSchedule"/> |
| | 144 | | /// the Job Manager, Job Preparation and Job Release tasks). |
| | 145 | | /// </remarks> |
| | 146 | | public IList<EnvironmentSetting> CommonEnvironmentSettings |
| | 147 | | { |
| 768 | 148 | | get { return this.propertyContainer.CommonEnvironmentSettingsProperty.Value; } |
| | 149 | | set |
| | 150 | | { |
| 68 | 151 | | this.propertyContainer.CommonEnvironmentSettingsProperty.Value = ConcurrentChangeTrackedModifiableList<E |
| 67 | 152 | | } |
| | 153 | | } |
| | 154 | |
|
| | 155 | | /// <summary> |
| | 156 | | /// Gets or sets the execution constraints for jobs created via this <see cref="JobSpecification"/>. |
| | 157 | | /// </summary> |
| | 158 | | public JobConstraints Constraints |
| | 159 | | { |
| 768 | 160 | | get { return this.propertyContainer.ConstraintsProperty.Value; } |
| 141 | 161 | | set { this.propertyContainer.ConstraintsProperty.Value = value; } |
| | 162 | | } |
| | 163 | |
|
| | 164 | | /// <summary> |
| | 165 | | /// Gets or sets a display name for all jobs created via this <see cref="JobSpecification"/>. |
| | 166 | | /// </summary> |
| | 167 | | public string DisplayName |
| | 168 | | { |
| 769 | 169 | | get { return this.propertyContainer.DisplayNameProperty.Value; } |
| 113 | 170 | | set { this.propertyContainer.DisplayNameProperty.Value = value; } |
| | 171 | | } |
| | 172 | |
|
| | 173 | | /// <summary> |
| | 174 | | /// Gets or sets details of a Job Manager task to be launched when a job is created via this <see cref="JobSpeci |
| | 175 | | /// </summary> |
| | 176 | | public JobManagerTask JobManagerTask |
| | 177 | | { |
| 768 | 178 | | get { return this.propertyContainer.JobManagerTaskProperty.Value; } |
| 125 | 179 | | set { this.propertyContainer.JobManagerTaskProperty.Value = value; } |
| | 180 | | } |
| | 181 | |
|
| | 182 | | /// <summary> |
| | 183 | | /// Gets or sets the Job Preparation task for jobs created via this <see cref="JobSpecification"/>. |
| | 184 | | /// </summary> |
| | 185 | | /// <remarks> |
| | 186 | | /// The Batch service will run the Job Preparation task on a compute node before starting any tasks of that job |
| | 187 | | /// that compute node. |
| | 188 | | /// </remarks> |
| | 189 | | public JobPreparationTask JobPreparationTask |
| | 190 | | { |
| 768 | 191 | | get { return this.propertyContainer.JobPreparationTaskProperty.Value; } |
| 123 | 192 | | set { this.propertyContainer.JobPreparationTaskProperty.Value = value; } |
| | 193 | | } |
| | 194 | |
|
| | 195 | | /// <summary> |
| | 196 | | /// Gets or sets the Job Release task for jobs created via this <see cref="JobSpecification"/>. |
| | 197 | | /// </summary> |
| | 198 | | /// <remarks> |
| | 199 | | /// The Batch service runs the Job Release task when the job ends, on each compute node where any task of the jo |
| | 200 | | /// has run. |
| | 201 | | /// </remarks> |
| | 202 | | public JobReleaseTask JobReleaseTask |
| | 203 | | { |
| 768 | 204 | | get { return this.propertyContainer.JobReleaseTaskProperty.Value; } |
| 137 | 205 | | set { this.propertyContainer.JobReleaseTaskProperty.Value = value; } |
| | 206 | | } |
| | 207 | |
|
| | 208 | | /// <summary> |
| | 209 | | /// Gets or sets a list of name-value pairs associated with jobs created via this <see cref="JobSpecification"/> |
| | 210 | | /// as metadata. |
| | 211 | | /// </summary> |
| | 212 | | public IList<MetadataItem> Metadata |
| | 213 | | { |
| 768 | 214 | | get { return this.propertyContainer.MetadataProperty.Value; } |
| | 215 | | set |
| | 216 | | { |
| 54 | 217 | | this.propertyContainer.MetadataProperty.Value = ConcurrentChangeTrackedModifiableList<MetadataItem>.Tran |
| 53 | 218 | | } |
| | 219 | | } |
| | 220 | |
|
| | 221 | | /// <summary> |
| | 222 | | /// Gets or sets the network configuration for the job. |
| | 223 | | /// </summary> |
| | 224 | | public JobNetworkConfiguration NetworkConfiguration |
| | 225 | | { |
| 768 | 226 | | get { return this.propertyContainer.NetworkConfigurationProperty.Value; } |
| 143 | 227 | | set { this.propertyContainer.NetworkConfigurationProperty.Value = value; } |
| | 228 | | } |
| | 229 | |
|
| | 230 | | /// <summary> |
| | 231 | | /// Gets or sets the action the Batch service should take when all tasks in the job are in the <see cref="Common |
| | 232 | | /// state. |
| | 233 | | /// </summary> |
| | 234 | | public Common.OnAllTasksComplete? OnAllTasksComplete |
| | 235 | | { |
| 771 | 236 | | get { return this.propertyContainer.OnAllTasksCompleteProperty.Value; } |
| 137 | 237 | | set { this.propertyContainer.OnAllTasksCompleteProperty.Value = value; } |
| | 238 | | } |
| | 239 | |
|
| | 240 | | /// <summary> |
| | 241 | | /// Gets or sets the action the Batch service should take when any task in the job fails. |
| | 242 | | /// </summary> |
| | 243 | | /// <remarks> |
| | 244 | | /// A task is considered to have failed if it completes with a non-zero exit code and has exhausted its retry co |
| | 245 | | /// or if it had a scheduling error. |
| | 246 | | /// </remarks> |
| | 247 | | public Common.OnTaskFailure? OnTaskFailure |
| | 248 | | { |
| 771 | 249 | | get { return this.propertyContainer.OnTaskFailureProperty.Value; } |
| 137 | 250 | | set { this.propertyContainer.OnTaskFailureProperty.Value = value; } |
| | 251 | | } |
| | 252 | |
|
| | 253 | | /// <summary> |
| | 254 | | /// Gets or sets the pool on which the Batch service runs the tasks of jobs created via this <see cref="JobSpeci |
| | 255 | | /// </summary> |
| | 256 | | public PoolInformation PoolInformation |
| | 257 | | { |
| 771 | 258 | | get { return this.propertyContainer.PoolInformationProperty.Value; } |
| 427 | 259 | | set { this.propertyContainer.PoolInformationProperty.Value = value; } |
| | 260 | | } |
| | 261 | |
|
| | 262 | | /// <summary> |
| | 263 | | /// Gets or sets the priority of jobs created via this <see cref="JobSpecification"/>. |
| | 264 | | /// </summary> |
| | 265 | | /// <remarks> |
| | 266 | | /// Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highe |
| | 267 | | /// priority. |
| | 268 | | /// </remarks> |
| | 269 | | public int? Priority |
| | 270 | | { |
| 768 | 271 | | get { return this.propertyContainer.PriorityProperty.Value; } |
| 135 | 272 | | set { this.propertyContainer.PriorityProperty.Value = value; } |
| | 273 | | } |
| | 274 | |
|
| | 275 | | /// <summary> |
| | 276 | | /// Gets or sets whether tasks in jobs created under this <see cref="CloudJobSchedule"/> can define dependencies |
| | 277 | | /// on each other. |
| | 278 | | /// </summary> |
| | 279 | | /// <remarks> |
| | 280 | | /// The default value is false. |
| | 281 | | /// </remarks> |
| | 282 | | public bool? UsesTaskDependencies |
| | 283 | | { |
| 769 | 284 | | get { return this.propertyContainer.UsesTaskDependenciesProperty.Value; } |
| 144 | 285 | | set { this.propertyContainer.UsesTaskDependenciesProperty.Value = value; } |
| | 286 | | } |
| | 287 | |
|
| | 288 | | #endregion // JobSpecification |
| | 289 | |
|
| | 290 | | #region IPropertyMetadata |
| | 291 | |
|
| | 292 | | bool IModifiable.HasBeenModified |
| | 293 | | { |
| 2 | 294 | | get { return this.propertyContainer.HasBeenModified; } |
| | 295 | | } |
| | 296 | |
|
| | 297 | | bool IReadOnly.IsReadOnly |
| | 298 | | { |
| 0 | 299 | | get { return this.propertyContainer.IsReadOnly; } |
| 12 | 300 | | set { this.propertyContainer.IsReadOnly = value; } |
| | 301 | | } |
| | 302 | |
|
| | 303 | | #endregion //IPropertyMetadata |
| | 304 | |
|
| | 305 | | #region Internal/private methods |
| | 306 | | /// <summary> |
| | 307 | | /// Return a protocol object of the requested type. |
| | 308 | | /// </summary> |
| | 309 | | /// <returns>The protocol object of the requested type.</returns> |
| | 310 | | Models.JobSpecification ITransportObjectProvider<Models.JobSpecification>.GetTransportObject() |
| | 311 | | { |
| 146 | 312 | | Models.JobSpecification result = new Models.JobSpecification() |
| 146 | 313 | | { |
| 146 | 314 | | CommonEnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.CommonEnvironmentSettings |
| 216 | 315 | | Constraints = UtilitiesInternal.CreateObjectWithNullCheck(this.Constraints, (o) => o.GetTransportObject( |
| 146 | 316 | | DisplayName = this.DisplayName, |
| 208 | 317 | | JobManagerTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobManagerTask, (o) => o.GetTransportO |
| 207 | 318 | | JobPreparationTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobPreparationTask, (o) => o.GetTr |
| 214 | 319 | | JobReleaseTask = UtilitiesInternal.CreateObjectWithNullCheck(this.JobReleaseTask, (o) => o.GetTransportO |
| 146 | 320 | | Metadata = UtilitiesInternal.ConvertToProtocolCollection(this.Metadata), |
| 217 | 321 | | NetworkConfiguration = UtilitiesInternal.CreateObjectWithNullCheck(this.NetworkConfiguration, (o) => o.G |
| 146 | 322 | | OnAllTasksComplete = UtilitiesInternal.MapNullableEnum<Common.OnAllTasksComplete, Models.OnAllTasksCompl |
| 146 | 323 | | OnTaskFailure = UtilitiesInternal.MapNullableEnum<Common.OnTaskFailure, Models.OnTaskFailure>(this.OnTas |
| 212 | 324 | | PoolInfo = UtilitiesInternal.CreateObjectWithNullCheck(this.PoolInformation, (o) => o.GetTransportObject |
| 146 | 325 | | Priority = this.Priority, |
| 146 | 326 | | UsesTaskDependencies = this.UsesTaskDependencies, |
| 146 | 327 | | }; |
| | 328 | |
|
| 146 | 329 | | return result; |
| | 330 | | } |
| | 331 | |
|
| | 332 | |
|
| | 333 | | #endregion // Internal/private methods |
| | 334 | | } |
| | 335 | | } |