| | 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 |
| 218 | 14 | | { |
| | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| 218 | 16 | | using System; |
| | 17 | | using System.Collections.Generic; |
| | 18 | | using System.Linq; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// A Job Release task to run on job completion on any compute node where the job has run. |
| | 22 | | /// </summary> |
| | 23 | | public partial class JobReleaseTask : ITransportObjectProvider<Models.JobReleaseTask>, IPropertyMetadata |
| | 24 | | { |
| | 25 | | private class PropertyContainer : PropertyCollection |
| | 26 | | { |
| | 27 | | public readonly PropertyAccessor<string> CommandLineProperty; |
| | 28 | | public readonly PropertyAccessor<TaskContainerSettings> ContainerSettingsProperty; |
| | 29 | | public readonly PropertyAccessor<IList<EnvironmentSetting>> EnvironmentSettingsProperty; |
| | 30 | | public readonly PropertyAccessor<string> IdProperty; |
| | 31 | | public readonly PropertyAccessor<TimeSpan?> MaxWallClockTimeProperty; |
| | 32 | | public readonly PropertyAccessor<IList<ResourceFile>> ResourceFilesProperty; |
| | 33 | | public readonly PropertyAccessor<TimeSpan?> RetentionTimeProperty; |
| | 34 | | public readonly PropertyAccessor<UserIdentity> UserIdentityProperty; |
| | 35 | |
|
| 218 | 36 | | public PropertyContainer() : base(BindingState.Unbound) |
| | 37 | | { |
| 218 | 38 | | this.CommandLineProperty = this.CreatePropertyAccessor<string>(nameof(CommandLine), BindingAccess.Read | |
| 218 | 39 | | this.ContainerSettingsProperty = this.CreatePropertyAccessor<TaskContainerSettings>(nameof(ContainerSett |
| 218 | 40 | | this.EnvironmentSettingsProperty = this.CreatePropertyAccessor<IList<EnvironmentSetting>>(nameof(Environ |
| 218 | 41 | | this.IdProperty = this.CreatePropertyAccessor<string>(nameof(Id), BindingAccess.Read | BindingAccess.Wri |
| 218 | 42 | | this.MaxWallClockTimeProperty = this.CreatePropertyAccessor<TimeSpan?>(nameof(MaxWallClockTime), Binding |
| 218 | 43 | | this.ResourceFilesProperty = this.CreatePropertyAccessor<IList<ResourceFile>>(nameof(ResourceFiles), Bin |
| 218 | 44 | | this.RetentionTimeProperty = this.CreatePropertyAccessor<TimeSpan?>(nameof(RetentionTime), BindingAccess |
| 218 | 45 | | this.UserIdentityProperty = this.CreatePropertyAccessor<UserIdentity>(nameof(UserIdentity), BindingAcces |
| 218 | 46 | | } |
| | 47 | |
|
| 756 | 48 | | public PropertyContainer(Models.JobReleaseTask protocolObject) : base(BindingState.Bound) |
| | 49 | | { |
| 756 | 50 | | this.CommandLineProperty = this.CreatePropertyAccessor( |
| 756 | 51 | | protocolObject.CommandLine, |
| 756 | 52 | | nameof(CommandLine), |
| 756 | 53 | | BindingAccess.Read | BindingAccess.Write); |
| 756 | 54 | | this.ContainerSettingsProperty = this.CreatePropertyAccessor( |
| 1118 | 55 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ContainerSettings, o => new TaskContainer |
| 756 | 56 | | nameof(ContainerSettings), |
| 756 | 57 | | BindingAccess.Read); |
| 756 | 58 | | this.EnvironmentSettingsProperty = this.CreatePropertyAccessor( |
| 756 | 59 | | EnvironmentSetting.ConvertFromProtocolCollection(protocolObject.EnvironmentSettings), |
| 756 | 60 | | nameof(EnvironmentSettings), |
| 756 | 61 | | BindingAccess.Read | BindingAccess.Write); |
| 756 | 62 | | this.IdProperty = this.CreatePropertyAccessor( |
| 756 | 63 | | protocolObject.Id, |
| 756 | 64 | | nameof(Id), |
| 756 | 65 | | BindingAccess.Read | BindingAccess.Write); |
| 756 | 66 | | this.MaxWallClockTimeProperty = this.CreatePropertyAccessor( |
| 756 | 67 | | protocolObject.MaxWallClockTime, |
| 756 | 68 | | nameof(MaxWallClockTime), |
| 756 | 69 | | BindingAccess.Read | BindingAccess.Write); |
| 756 | 70 | | this.ResourceFilesProperty = this.CreatePropertyAccessor( |
| 756 | 71 | | ResourceFile.ConvertFromProtocolCollection(protocolObject.ResourceFiles), |
| 756 | 72 | | nameof(ResourceFiles), |
| 756 | 73 | | BindingAccess.Read | BindingAccess.Write); |
| 756 | 74 | | this.RetentionTimeProperty = this.CreatePropertyAccessor( |
| 756 | 75 | | protocolObject.RetentionTime, |
| 756 | 76 | | nameof(RetentionTime), |
| 756 | 77 | | BindingAccess.Read | BindingAccess.Write); |
| 756 | 78 | | this.UserIdentityProperty = this.CreatePropertyAccessor( |
| 1154 | 79 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.UserIdentity, o => new UserIdentity(o)), |
| 756 | 80 | | nameof(UserIdentity), |
| 756 | 81 | | BindingAccess.Read | BindingAccess.Write); |
| 756 | 82 | | } |
| | 83 | | } |
| | 84 | |
|
| | 85 | | private readonly PropertyContainer propertyContainer; |
| | 86 | |
|
| | 87 | | #region Constructors |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Initializes a new instance of the <see cref="JobReleaseTask"/> class. |
| | 91 | | /// </summary> |
| | 92 | | /// <param name='commandLine'>The command line of the task.</param> |
| 218 | 93 | | public JobReleaseTask( |
| 218 | 94 | | string commandLine) |
| | 95 | | { |
| 218 | 96 | | this.propertyContainer = new PropertyContainer(); |
| 218 | 97 | | this.CommandLine = commandLine; |
| 218 | 98 | | } |
| | 99 | |
|
| 756 | 100 | | internal JobReleaseTask(Models.JobReleaseTask protocolObject) |
| | 101 | | { |
| 756 | 102 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| 756 | 103 | | } |
| | 104 | |
|
| | 105 | | #endregion Constructors |
| | 106 | |
|
| | 107 | | #region JobReleaseTask |
| | 108 | |
|
| | 109 | | /// <summary> |
| | 110 | | /// Gets or sets the command line of the task. |
| | 111 | | /// </summary> |
| | 112 | | /// <remarks> |
| | 113 | | /// The command line does not run under a shell, and therefore cannot take advantage of shell features such as e |
| | 114 | | /// variable expansion. If you want to take advantage of such features, you should invoke the shell in the comma |
| | 115 | | /// line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command lin |
| | 116 | | /// refers to file paths, it should use a relative path (relative to the task working directory), or use the Bat |
| | 117 | | /// provided environment variables (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment- |
| | 118 | | /// </remarks> |
| | 119 | | public string CommandLine |
| | 120 | | { |
| 1191 | 121 | | get { return this.propertyContainer.CommandLineProperty.Value; } |
| 645 | 122 | | set { this.propertyContainer.CommandLineProperty.Value = value; } |
| | 123 | | } |
| | 124 | |
|
| | 125 | | /// <summary> |
| | 126 | | /// Gets or sets the settings for the container under which the task runs. |
| | 127 | | /// </summary> |
| | 128 | | /// <remarks> |
| | 129 | | /// When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batc |
| | 130 | | /// directories on the node) are mapped into the container, all task environment variables are mapped into the c |
| | 131 | | /// and the task command line is executed in the container. Files produced in the container outside of AZ_BATCH_ |
| | 132 | | /// might not be reflected to the host disk, meaning that Batch file APIs will not be able to access them. |
| | 133 | | /// </remarks> |
| | 134 | | public TaskContainerSettings ContainerSettings |
| | 135 | | { |
| 1191 | 136 | | get { return this.propertyContainer.ContainerSettingsProperty.Value; } |
| 211 | 137 | | set { this.propertyContainer.ContainerSettingsProperty.Value = value; } |
| | 138 | | } |
| | 139 | |
|
| | 140 | | /// <summary> |
| | 141 | | /// Gets or sets the collection of EnvironmentSetting instances. |
| | 142 | | /// </summary> |
| | 143 | | public IList<EnvironmentSetting> EnvironmentSettings |
| | 144 | | { |
| 1191 | 145 | | get { return this.propertyContainer.EnvironmentSettingsProperty.Value; } |
| | 146 | | set |
| | 147 | | { |
| 110 | 148 | | this.propertyContainer.EnvironmentSettingsProperty.Value = ConcurrentChangeTrackedModifiableList<Environ |
| 109 | 149 | | } |
| | 150 | | } |
| | 151 | |
|
| | 152 | | /// <summary> |
| | 153 | | /// Gets or sets the id of the task. |
| | 154 | | /// </summary> |
| | 155 | | public string Id |
| | 156 | | { |
| 1191 | 157 | | get { return this.propertyContainer.IdProperty.Value; } |
| 209 | 158 | | set { this.propertyContainer.IdProperty.Value = value; } |
| | 159 | | } |
| | 160 | |
|
| | 161 | | /// <summary> |
| | 162 | | /// Gets or sets the maximum duration of time for which a task is allowed to run from the time it is created. |
| | 163 | | /// </summary> |
| | 164 | | public TimeSpan? MaxWallClockTime |
| | 165 | | { |
| 1191 | 166 | | get { return this.propertyContainer.MaxWallClockTimeProperty.Value; } |
| 219 | 167 | | set { this.propertyContainer.MaxWallClockTimeProperty.Value = value; } |
| | 168 | | } |
| | 169 | |
|
| | 170 | | /// <summary> |
| | 171 | | /// Gets or sets a list of files that the Batch service will download to the compute node before running the com |
| | 172 | | /// line. |
| | 173 | | /// </summary> |
| | 174 | | /// <remarks> |
| | 175 | | /// There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail |
| | 176 | | /// and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files |
| | 177 | | /// be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. |
| | 178 | | /// </remarks> |
| | 179 | | public IList<ResourceFile> ResourceFiles |
| | 180 | | { |
| 1191 | 181 | | get { return this.propertyContainer.ResourceFilesProperty.Value; } |
| | 182 | | set |
| | 183 | | { |
| 109 | 184 | | this.propertyContainer.ResourceFilesProperty.Value = ConcurrentChangeTrackedModifiableList<ResourceFile> |
| 108 | 185 | | } |
| | 186 | | } |
| | 187 | |
|
| | 188 | | /// <summary> |
| | 189 | | /// Gets or sets the duration of time for which files in the task's working directory are retained, from the tim |
| | 190 | | /// it completes execution. After this duration, the task's working directory is reclaimed. |
| | 191 | | /// </summary> |
| | 192 | | /// <remarks> |
| | 193 | | /// The default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is remove |
| | 194 | | /// or the job is deleted. |
| | 195 | | /// </remarks> |
| | 196 | | public TimeSpan? RetentionTime |
| | 197 | | { |
| 1191 | 198 | | get { return this.propertyContainer.RetentionTimeProperty.Value; } |
| 213 | 199 | | set { this.propertyContainer.RetentionTimeProperty.Value = value; } |
| | 200 | | } |
| | 201 | |
|
| | 202 | | /// <summary> |
| | 203 | | /// Gets or sets the user identity under which the task runs. |
| | 204 | | /// </summary> |
| | 205 | | /// <remarks> |
| | 206 | | /// If omitted, the task runs as a non-administrative user unique to the task. |
| | 207 | | /// </remarks> |
| | 208 | | public UserIdentity UserIdentity |
| | 209 | | { |
| 1191 | 210 | | get { return this.propertyContainer.UserIdentityProperty.Value; } |
| 189 | 211 | | set { this.propertyContainer.UserIdentityProperty.Value = value; } |
| | 212 | | } |
| | 213 | |
|
| | 214 | | #endregion // JobReleaseTask |
| | 215 | |
|
| | 216 | | #region IPropertyMetadata |
| | 217 | |
|
| | 218 | | bool IModifiable.HasBeenModified |
| | 219 | | { |
| 0 | 220 | | get { return this.propertyContainer.HasBeenModified; } |
| | 221 | | } |
| | 222 | |
|
| | 223 | | bool IReadOnly.IsReadOnly |
| | 224 | | { |
| 0 | 225 | | get { return this.propertyContainer.IsReadOnly; } |
| 1018 | 226 | | set { this.propertyContainer.IsReadOnly = value; } |
| | 227 | | } |
| | 228 | |
|
| | 229 | | #endregion //IPropertyMetadata |
| | 230 | |
|
| | 231 | | #region Internal/private methods |
| | 232 | | /// <summary> |
| | 233 | | /// Return a protocol object of the requested type. |
| | 234 | | /// </summary> |
| | 235 | | /// <returns>The protocol object of the requested type.</returns> |
| | 236 | | Models.JobReleaseTask ITransportObjectProvider<Models.JobReleaseTask>.GetTransportObject() |
| | 237 | | { |
| 217 | 238 | | Models.JobReleaseTask result = new Models.JobReleaseTask() |
| 217 | 239 | | { |
| 217 | 240 | | CommandLine = this.CommandLine, |
| 322 | 241 | | ContainerSettings = UtilitiesInternal.CreateObjectWithNullCheck(this.ContainerSettings, (o) => o.GetTran |
| 217 | 242 | | EnvironmentSettings = UtilitiesInternal.ConvertToProtocolCollection(this.EnvironmentSettings), |
| 217 | 243 | | Id = this.Id, |
| 217 | 244 | | MaxWallClockTime = this.MaxWallClockTime, |
| 217 | 245 | | ResourceFiles = UtilitiesInternal.ConvertToProtocolCollection(this.ResourceFiles), |
| 217 | 246 | | RetentionTime = this.RetentionTime, |
| 311 | 247 | | UserIdentity = UtilitiesInternal.CreateObjectWithNullCheck(this.UserIdentity, (o) => o.GetTransportObjec |
| 217 | 248 | | }; |
| | 249 | |
|
| 217 | 250 | | return result; |
| | 251 | | } |
| | 252 | |
|
| | 253 | |
|
| | 254 | | #endregion // Internal/private methods |
| | 255 | | } |
| | 256 | | } |