| | | 1 | | // <auto-generated> |
| | | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | | 4 | | // license information. |
| | | 5 | | // |
| | | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | | 8 | | // regenerated. |
| | | 9 | | // </auto-generated> |
| | | 10 | | |
| | | 11 | | namespace Microsoft.Azure.Batch.Protocol |
| | | 12 | | { |
| | | 13 | | using Microsoft.Rest; |
| | | 14 | | using Microsoft.Rest.Azure; |
| | | 15 | | using Microsoft.Rest.Serialization; |
| | | 16 | | using Models; |
| | | 17 | | using Newtonsoft.Json; |
| | | 18 | | using System.Collections; |
| | | 19 | | using System.Collections.Generic; |
| | | 20 | | using System.Linq; |
| | | 21 | | using System.Net; |
| | | 22 | | using System.Net.Http; |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// A client for issuing REST requests to the Azure Batch service. |
| | | 26 | | /// </summary> |
| | | 27 | | public partial class BatchServiceClient : ServiceClient<BatchServiceClient>, IBatchServiceClient, IAzureClient |
| | | 28 | | { |
| | | 29 | | /// <summary> |
| | | 30 | | /// The base URI of the service. |
| | | 31 | | /// </summary> |
| | 150 | 32 | | internal string BaseUri {get; set;} |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets or sets json serialization settings. |
| | | 36 | | /// </summary> |
| | 152 | 37 | | public JsonSerializerSettings SerializationSettings { get; private set; } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets or sets json deserialization settings. |
| | | 41 | | /// </summary> |
| | 312 | 42 | | public JsonSerializerSettings DeserializationSettings { get; private set; } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Credentials needed for the client to connect to Azure. |
| | | 46 | | /// </summary> |
| | 468 | 47 | | public ServiceClientCredentials Credentials { get; private set; } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// Client API Version. |
| | | 51 | | /// </summary> |
| | 171 | 52 | | public string ApiVersion { get; private set; } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// The base URL for all Azure Batch service requests. |
| | | 56 | | /// </summary> |
| | 163 | 57 | | public string BatchUrl { get; set; } |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// The preferred language for the response. |
| | | 61 | | /// </summary> |
| | 164 | 62 | | public string AcceptLanguage { get; set; } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// The retry timeout in seconds for Long Running Operations. Default value is |
| | | 66 | | /// 30. |
| | | 67 | | /// </summary> |
| | 0 | 68 | | public int? LongRunningOperationRetryTimeout { get; set; } |
| | | 69 | | |
| | | 70 | | /// <summary> |
| | | 71 | | /// Whether a unique x-ms-client-request-id should be generated. When set to |
| | | 72 | | /// true a unique x-ms-client-request-id value is generated and included in |
| | | 73 | | /// each request. Default is true. |
| | | 74 | | /// </summary> |
| | 164 | 75 | | public bool? GenerateClientRequestId { get; set; } |
| | | 76 | | |
| | | 77 | | /// <summary> |
| | | 78 | | /// Gets the IApplicationOperations. |
| | | 79 | | /// </summary> |
| | 144 | 80 | | public virtual IApplicationOperations Application { get; private set; } |
| | | 81 | | |
| | | 82 | | /// <summary> |
| | | 83 | | /// Gets the IPoolOperations. |
| | | 84 | | /// </summary> |
| | 145 | 85 | | public virtual IPoolOperations Pool { get; private set; } |
| | | 86 | | |
| | | 87 | | /// <summary> |
| | | 88 | | /// Gets the IAccountOperations. |
| | | 89 | | /// </summary> |
| | 0 | 90 | | public virtual IAccountOperations Account { get; private set; } |
| | | 91 | | |
| | | 92 | | /// <summary> |
| | | 93 | | /// Gets the IJobOperations. |
| | | 94 | | /// </summary> |
| | 141 | 95 | | public virtual IJobOperations Job { get; private set; } |
| | | 96 | | |
| | | 97 | | /// <summary> |
| | | 98 | | /// Gets the ICertificateOperations. |
| | | 99 | | /// </summary> |
| | 141 | 100 | | public virtual ICertificateOperations Certificate { get; private set; } |
| | | 101 | | |
| | | 102 | | /// <summary> |
| | | 103 | | /// Gets the IFileOperations. |
| | | 104 | | /// </summary> |
| | 144 | 105 | | public virtual IFileOperations File { get; private set; } |
| | | 106 | | |
| | | 107 | | /// <summary> |
| | | 108 | | /// Gets the IJobScheduleOperations. |
| | | 109 | | /// </summary> |
| | 141 | 110 | | public virtual IJobScheduleOperations JobSchedule { get; private set; } |
| | | 111 | | |
| | | 112 | | /// <summary> |
| | | 113 | | /// Gets the ITaskOperations. |
| | | 114 | | /// </summary> |
| | 0 | 115 | | public virtual ITaskOperations Task { get; private set; } |
| | | 116 | | |
| | | 117 | | /// <summary> |
| | | 118 | | /// Gets the IComputeNodeOperations. |
| | | 119 | | /// </summary> |
| | 0 | 120 | | public virtual IComputeNodeOperations ComputeNode { get; private set; } |
| | | 121 | | |
| | | 122 | | /// <summary> |
| | | 123 | | /// Initializes a new instance of the BatchServiceClient class. |
| | | 124 | | /// </summary> |
| | | 125 | | /// <param name='httpClient'> |
| | | 126 | | /// HttpClient to be used |
| | | 127 | | /// </param> |
| | | 128 | | /// <param name='disposeHttpClient'> |
| | | 129 | | /// True: will dispose the provided httpClient on calling BatchServiceClient.Dispose(). False: will not dispose |
| | 0 | 130 | | protected BatchServiceClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient |
| | | 131 | | { |
| | 0 | 132 | | Initialize(); |
| | 0 | 133 | | } |
| | | 134 | | |
| | | 135 | | /// <summary> |
| | | 136 | | /// Initializes a new instance of the BatchServiceClient class. |
| | | 137 | | /// </summary> |
| | | 138 | | /// <param name='handlers'> |
| | | 139 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | | 140 | | /// </param> |
| | 146 | 141 | | protected BatchServiceClient(params DelegatingHandler[] handlers) : base(handlers) |
| | | 142 | | { |
| | 146 | 143 | | Initialize(); |
| | 146 | 144 | | } |
| | | 145 | | |
| | | 146 | | /// <summary> |
| | | 147 | | /// Initializes a new instance of the BatchServiceClient class. |
| | | 148 | | /// </summary> |
| | | 149 | | /// <param name='rootHandler'> |
| | | 150 | | /// Optional. The http client handler used to handle http transport. |
| | | 151 | | /// </param> |
| | | 152 | | /// <param name='handlers'> |
| | | 153 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | | 154 | | /// </param> |
| | 2 | 155 | | protected BatchServiceClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHand |
| | | 156 | | { |
| | 2 | 157 | | Initialize(); |
| | 2 | 158 | | } |
| | | 159 | | |
| | | 160 | | /// <summary> |
| | | 161 | | /// Initializes a new instance of the BatchServiceClient class. |
| | | 162 | | /// </summary> |
| | | 163 | | /// <param name='credentials'> |
| | | 164 | | /// Required. Credentials needed for the client to connect to Azure. |
| | | 165 | | /// </param> |
| | | 166 | | /// <param name='handlers'> |
| | | 167 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | | 168 | | /// </param> |
| | | 169 | | /// <exception cref="System.ArgumentNullException"> |
| | | 170 | | /// Thrown when a required parameter is null |
| | | 171 | | /// </exception> |
| | 146 | 172 | | public BatchServiceClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(hand |
| | | 173 | | { |
| | 146 | 174 | | if (credentials == null) |
| | | 175 | | { |
| | 0 | 176 | | throw new System.ArgumentNullException("credentials"); |
| | | 177 | | } |
| | 146 | 178 | | Credentials = credentials; |
| | 146 | 179 | | if (Credentials != null) |
| | | 180 | | { |
| | 146 | 181 | | Credentials.InitializeServiceClient(this); |
| | | 182 | | } |
| | 146 | 183 | | } |
| | | 184 | | |
| | | 185 | | /// <summary> |
| | | 186 | | /// Initializes a new instance of the BatchServiceClient class. |
| | | 187 | | /// </summary> |
| | | 188 | | /// <param name='credentials'> |
| | | 189 | | /// Required. Credentials needed for the client to connect to Azure. |
| | | 190 | | /// </param> |
| | | 191 | | /// <param name='httpClient'> |
| | | 192 | | /// HttpClient to be used |
| | | 193 | | /// </param> |
| | | 194 | | /// <param name='disposeHttpClient'> |
| | | 195 | | /// True: will dispose the provided httpClient on calling BatchServiceClient.Dispose(). False: will not dispose |
| | | 196 | | /// <exception cref="System.ArgumentNullException"> |
| | | 197 | | /// Thrown when a required parameter is null |
| | | 198 | | /// </exception> |
| | 0 | 199 | | public BatchServiceClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : |
| | | 200 | | { |
| | 0 | 201 | | if (credentials == null) |
| | | 202 | | { |
| | 0 | 203 | | throw new System.ArgumentNullException("credentials"); |
| | | 204 | | } |
| | 0 | 205 | | Credentials = credentials; |
| | 0 | 206 | | if (Credentials != null) |
| | | 207 | | { |
| | 0 | 208 | | Credentials.InitializeServiceClient(this); |
| | | 209 | | } |
| | 0 | 210 | | } |
| | | 211 | | |
| | | 212 | | /// <summary> |
| | | 213 | | /// Initializes a new instance of the BatchServiceClient class. |
| | | 214 | | /// </summary> |
| | | 215 | | /// <param name='credentials'> |
| | | 216 | | /// Required. Credentials needed for the client to connect to Azure. |
| | | 217 | | /// </param> |
| | | 218 | | /// <param name='rootHandler'> |
| | | 219 | | /// Optional. The http client handler used to handle http transport. |
| | | 220 | | /// </param> |
| | | 221 | | /// <param name='handlers'> |
| | | 222 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | | 223 | | /// </param> |
| | | 224 | | /// <exception cref="System.ArgumentNullException"> |
| | | 225 | | /// Thrown when a required parameter is null |
| | | 226 | | /// </exception> |
| | 2 | 227 | | public BatchServiceClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Delegating |
| | | 228 | | { |
| | 2 | 229 | | if (credentials == null) |
| | | 230 | | { |
| | 0 | 231 | | throw new System.ArgumentNullException("credentials"); |
| | | 232 | | } |
| | 2 | 233 | | Credentials = credentials; |
| | 2 | 234 | | if (Credentials != null) |
| | | 235 | | { |
| | 2 | 236 | | Credentials.InitializeServiceClient(this); |
| | | 237 | | } |
| | 2 | 238 | | } |
| | | 239 | | |
| | | 240 | | /// <summary> |
| | | 241 | | /// An optional partial-method to perform custom initialization. |
| | | 242 | | /// </summary> |
| | | 243 | | partial void CustomInitialize(); |
| | | 244 | | /// <summary> |
| | | 245 | | /// Initializes client properties. |
| | | 246 | | /// </summary> |
| | | 247 | | private void Initialize() |
| | | 248 | | { |
| | 148 | 249 | | Application = new ApplicationOperations(this); |
| | 148 | 250 | | Pool = new PoolOperations(this); |
| | 148 | 251 | | Account = new AccountOperations(this); |
| | 148 | 252 | | Job = new JobOperations(this); |
| | 148 | 253 | | Certificate = new CertificateOperations(this); |
| | 148 | 254 | | File = new FileOperations(this); |
| | 148 | 255 | | JobSchedule = new JobScheduleOperations(this); |
| | 148 | 256 | | Task = new TaskOperations(this); |
| | 148 | 257 | | ComputeNode = new ComputeNodeOperations(this); |
| | 148 | 258 | | BaseUri = "{batchUrl}"; |
| | 148 | 259 | | ApiVersion = "2020-03-01.11.0"; |
| | 148 | 260 | | AcceptLanguage = "en-US"; |
| | 148 | 261 | | LongRunningOperationRetryTimeout = 30; |
| | 148 | 262 | | GenerateClientRequestId = true; |
| | 148 | 263 | | SerializationSettings = new JsonSerializerSettings |
| | 148 | 264 | | { |
| | 148 | 265 | | Formatting = Newtonsoft.Json.Formatting.Indented, |
| | 148 | 266 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| | 148 | 267 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| | 148 | 268 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| | 148 | 269 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| | 148 | 270 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| | 148 | 271 | | Converters = new List<JsonConverter> |
| | 148 | 272 | | { |
| | 148 | 273 | | new Iso8601TimeSpanConverter() |
| | 148 | 274 | | } |
| | 148 | 275 | | }; |
| | 148 | 276 | | DeserializationSettings = new JsonSerializerSettings |
| | 148 | 277 | | { |
| | 148 | 278 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| | 148 | 279 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| | 148 | 280 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| | 148 | 281 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| | 148 | 282 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| | 148 | 283 | | Converters = new List<JsonConverter> |
| | 148 | 284 | | { |
| | 148 | 285 | | new Iso8601TimeSpanConverter() |
| | 148 | 286 | | } |
| | 148 | 287 | | }; |
| | | 288 | | CustomInitialize(); |
| | 148 | 289 | | DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); |
| | 148 | 290 | | } |
| | | 291 | | } |
| | | 292 | | } |