diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/BatchManagementClient.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/BatchManagementClient.cs index 0b484dde5f6a1..848c466243344 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/BatchManagementClient.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/BatchManagementClient.cs @@ -368,7 +368,7 @@ private void Initialize() PrivateEndpointConnection = new PrivateEndpointConnectionOperations(this); Pool = new PoolOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-09-01"; + ApiVersion = "2021-01-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperations.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperations.cs index 6ba37009fe8a5..f215d73fcbb26 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperations.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperations.cs @@ -316,40 +316,6 @@ internal CertificateOperations(BatchManagementClient client) /// updating an existing certificate. Other values will be ignored. /// /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updates the properties of an existing certificate. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The identifier for the certificate. This must be made up of algorithm and - /// thumbprint separated by a dash, and must match the certificate data in the - /// request. For example SHA1-a3d1c5. - /// - /// - /// Certificate entity to update. - /// - /// - /// The entity state (ETag) version of the certificate to update. This value - /// can be omitted or set to "*" to apply the operation unconditionally. - /// - /// /// Headers that will be added to request. /// /// @@ -370,7 +336,7 @@ internal CertificateOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -418,6 +384,10 @@ internal CertificateOperations(BatchManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -438,8 +408,9 @@ internal CertificateOperations(BatchManagementClient client) tracingParameters.Add("certificateName", certificateName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -460,7 +431,7 @@ internal CertificateOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -475,6 +446,14 @@ internal CertificateOperations(BatchManagementClient client) } _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); } + if (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) @@ -560,7 +539,7 @@ internal CertificateOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -587,7 +566,7 @@ internal CertificateOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -606,7 +585,7 @@ internal CertificateOperations(BatchManagementClient client) } /// - /// Deletes the specified certificate. + /// Updates the properties of an existing certificate. /// /// /// The name of the resource group that contains the Batch account. @@ -619,32 +598,12 @@ internal CertificateOperations(BatchManagementClient client) /// thumbprint separated by a dash, and must match the certificate data in the /// request. For example SHA1-a3d1c5. /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets information about the specified certificate. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. + /// + /// Certificate entity to update. /// - /// - /// The identifier for the certificate. This must be made up of algorithm and - /// thumbprint separated by a dash, and must match the certificate data in the - /// request. For example SHA1-a3d1c5. + /// + /// The entity state (ETag) version of the certificate to update. This value + /// can be omitted or set to "*" to apply the operation unconditionally. /// /// /// Headers that will be added to request. @@ -667,7 +626,7 @@ internal CertificateOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -711,6 +670,10 @@ internal CertificateOperations(BatchManagementClient client) throw new ValidationException(ValidationRules.Pattern, "certificateName", "^[\\w]+-[\\w]+$"); } } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -729,8 +692,10 @@ internal CertificateOperations(BatchManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -751,13 +716,21 @@ internal CertificateOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) @@ -782,6 +755,12 @@ internal CertificateOperations(BatchManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -837,7 +816,7 @@ internal CertificateOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -864,7 +843,7 @@ internal CertificateOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -883,17 +862,35 @@ internal CertificateOperations(BatchManagementClient client) } /// - /// Cancels a failed deletion of a certificate from the specified account. + /// Deletes the specified certificate. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified certificate. /// - /// - /// If you try to delete a certificate that is being used by a pool or compute - /// node, the status of the certificate changes to deleteFailed. If you decide - /// that you want to continue using the certificate, you can use this operation - /// to set the status of the certificate back to active. If you intend to - /// delete the certificate, you do not need to run this operation after the - /// deletion failed. You must make sure that the certificate is not being used - /// by any resources, and then you can try again to delete the certificate. - /// /// /// The name of the resource group that contains the Batch account. /// @@ -926,7 +923,7 @@ internal CertificateOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CancelDeletionWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -989,11 +986,11 @@ internal CertificateOperations(BatchManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("certificateName", certificateName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CancelDeletion", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); @@ -1010,7 +1007,7 @@ internal CertificateOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1096,7 +1093,7 @@ internal CertificateOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1123,7 +1120,7 @@ internal CertificateOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -1142,8 +1139,17 @@ internal CertificateOperations(BatchManagementClient client) } /// - /// Creates a new certificate inside the specified account. + /// Cancels a failed deletion of a certificate from the specified account. /// + /// + /// If you try to delete a certificate that is being used by a pool or compute + /// node, the status of the certificate changes to deleteFailed. If you decide + /// that you want to continue using the certificate, you can use this operation + /// to set the status of the certificate back to active. If you intend to + /// delete the certificate, you do not need to run this operation after the + /// deletion failed. You must make sure that the certificate is not being used + /// by any resources, and then you can try again to delete the certificate. + /// /// /// The name of the resource group that contains the Batch account. /// @@ -1155,18 +1161,6 @@ internal CertificateOperations(BatchManagementClient client) /// thumbprint separated by a dash, and must match the certificate data in the /// request. For example SHA1-a3d1c5. /// - /// - /// Additional parameters for certificate creation. - /// - /// - /// The entity state (ETag) version of the certificate to update. A value of - /// "*" can be used to apply the operation only if the certificate already - /// exists. If omitted, this operation will always be applied. - /// - /// - /// Set to '*' to allow a new certificate to be created, but to prevent - /// updating an existing certificate. Other values will be ignored. - /// /// /// Headers that will be added to request. /// @@ -1188,7 +1182,7 @@ internal CertificateOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CancelDeletionWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1232,14 +1226,6 @@ internal CertificateOperations(BatchManagementClient client) throw new ValidationException(ValidationRules.Pattern, "certificateName", "^[\\w]+-[\\w]+$"); } } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1258,15 +1244,12 @@ internal CertificateOperations(BatchManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); tracingParameters.Add("certificateName", certificateName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("ifNoneMatch", ifNoneMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CancelDeletion", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); @@ -1283,29 +1266,13 @@ internal CertificateOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (ifMatch != null) - { - if (_httpRequest.Headers.Contains("If-Match")) - { - _httpRequest.Headers.Remove("If-Match"); - } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); - } - if (ifNoneMatch != null) - { - if (_httpRequest.Headers.Contains("If-None-Match")) - { - _httpRequest.Headers.Remove("If-None-Match"); - } - _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); - } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) @@ -1330,12 +1297,6 @@ internal CertificateOperations(BatchManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1391,7 +1352,7 @@ internal CertificateOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1418,7 +1379,7 @@ internal CertificateOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperationsExtensions.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperationsExtensions.cs index 8a96d1e3b5f30..751ce5bcf4347 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperationsExtensions.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/CertificateOperationsExtensions.cs @@ -393,80 +393,6 @@ public static Certificate CancelDeletion(this ICertificateOperations operations, } } - /// - /// Creates a new certificate inside the specified account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The identifier for the certificate. This must be made up of algorithm and - /// thumbprint separated by a dash, and must match the certificate data in the - /// request. For example SHA1-a3d1c5. - /// - /// - /// Additional parameters for certificate creation. - /// - /// - /// The entity state (ETag) version of the certificate to update. A value of - /// "*" can be used to apply the operation only if the certificate already - /// exists. If omitted, this operation will always be applied. - /// - /// - /// Set to '*' to allow a new certificate to be created, but to prevent - /// updating an existing certificate. Other values will be ignored. - /// - public static Certificate BeginCreate(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) - { - return operations.BeginCreateAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); - } - - /// - /// Creates a new certificate inside the specified account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The identifier for the certificate. This must be made up of algorithm and - /// thumbprint separated by a dash, and must match the certificate data in the - /// request. For example SHA1-a3d1c5. - /// - /// - /// Additional parameters for certificate creation. - /// - /// - /// The entity state (ETag) version of the certificate to update. A value of - /// "*" can be used to apply the operation only if the certificate already - /// exists. If omitted, this operation will always be applied. - /// - /// - /// Set to '*' to allow a new certificate to be created, but to prevent - /// updating an existing certificate. Other values will be ignored. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Deletes the specified certificate. /// diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/ICertificateOperations.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/ICertificateOperations.cs index c1d7c499b65c1..33fda0b43794d 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/ICertificateOperations.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/ICertificateOperations.cs @@ -242,49 +242,6 @@ public partial interface ICertificateOperations /// Task> CancelDeletionWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a new certificate inside the specified account. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The identifier for the certificate. This must be made up of - /// algorithm and thumbprint separated by a dash, and must match the - /// certificate data in the request. For example SHA1-a3d1c5. - /// - /// - /// Additional parameters for certificate creation. - /// - /// - /// The entity state (ETag) version of the certificate to update. A - /// value of "*" can be used to apply the operation only if the - /// certificate already exists. If omitted, this operation will always - /// be applied. - /// - /// - /// Set to '*' to allow a new certificate to be created, but to prevent - /// updating an existing certificate. Other values will be ignored. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Deletes the specified certificate. /// /// diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/IPoolOperations.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/IPoolOperations.cs index a4bc313650e75..ab3b08fc6ee58 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/IPoolOperations.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/IPoolOperations.cs @@ -269,46 +269,6 @@ public partial interface IPoolOperations /// Task> StopResizeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a new pool inside the specified account. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The pool name. This must be unique within the account. - /// - /// - /// Additional parameters for pool creation. - /// - /// - /// The entity state (ETag) version of the pool to update. A value of - /// "*" can be used to apply the operation only if the pool already - /// exists. If omitted, this operation will always be applied. - /// - /// - /// Set to '*' to allow a new pool to be created, but to prevent - /// updating an existing pool. Other values will be ignored. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Deletes the specified pool. /// /// diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccount.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccount.cs index b0987e033648e..597e19cc3252e 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccount.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccount.cs @@ -58,15 +58,15 @@ public BatchAccount() /// account. /// The dedicated core quota for the /// Batch account. - /// The low-priority core quota for + /// The low priority core quota for /// the Batch account. /// A list of the dedicated /// core quota per Virtual Machine family for the Batch account. For /// accounts with PoolAllocationMode set to UserSubscription, quota is /// managed on the subscription so this value is not returned. /// A value - /// indicating whether the core quota for the Batch Account is enforced - /// per Virtual Machine family or not. + /// indicating whether core quotas per Virtual Machine family are + /// enforced for this account /// The pool quota for the Batch /// account. /// The active job and job @@ -176,7 +176,7 @@ public BatchAccount() public int? DedicatedCoreQuota { get; private set; } /// - /// Gets the low-priority core quota for the Batch account. + /// Gets the low priority core quota for the Batch account. /// /// /// For accounts with PoolAllocationMode set to UserSubscription, quota @@ -195,8 +195,8 @@ public BatchAccount() public IList DedicatedCoreQuotaPerVMFamily { get; private set; } /// - /// Gets a value indicating whether the core quota for the Batch - /// Account is enforced per Virtual Machine family or not. + /// Gets a value indicating whether core quotas per Virtual Machine + /// family are enforced for this account /// /// /// Batch is transitioning its core quota system for dedicated cores to diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccountIdentity.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccountIdentity.cs index 6db16622608bd..ce247998c0313 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccountIdentity.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccountIdentity.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.Batch.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -32,18 +34,24 @@ public BatchAccountIdentity() /// Initializes a new instance of the BatchAccountIdentity class. /// /// The type of identity used for the Batch account. - /// Possible values include: 'SystemAssigned', 'None' + /// Possible values include: 'SystemAssigned', 'UserAssigned', + /// 'None' /// The principal id of the Batch account. /// This property will only be provided for a system assigned /// identity. /// The tenant id associated with the Batch /// account. This property will only be provided for a system assigned /// identity. - public BatchAccountIdentity(ResourceIdentityType type, string principalId = default(string), string tenantId = default(string)) + /// The list of user identities + /// associated with the Batch account. The user identity dictionary key + /// references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public BatchAccountIdentity(ResourceIdentityType type, string principalId = default(string), string tenantId = default(string), IDictionary userAssignedIdentities = default(IDictionary)) { PrincipalId = principalId; TenantId = tenantId; Type = type; + UserAssignedIdentities = userAssignedIdentities; CustomInit(); } @@ -68,11 +76,20 @@ public BatchAccountIdentity() /// /// Gets or sets the type of identity used for the Batch account. - /// Possible values include: 'SystemAssigned', 'None' + /// Possible values include: 'SystemAssigned', 'UserAssigned', 'None' /// [JsonProperty(PropertyName = "type")] public ResourceIdentityType Type { get; set; } + /// + /// Gets or sets the list of user identities associated with the Batch + /// account. The user identity dictionary key references will be ARM + /// resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + /// /// Validate the object. /// diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccountIdentityUserAssignedIdentitiesValue.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccountIdentityUserAssignedIdentitiesValue.cs new file mode 100644 index 0000000000000..e1072790153ca --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchAccountIdentityUserAssignedIdentitiesValue.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Batch.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class BatchAccountIdentityUserAssignedIdentitiesValue + { + /// + /// Initializes a new instance of the + /// BatchAccountIdentityUserAssignedIdentitiesValue class. + /// + public BatchAccountIdentityUserAssignedIdentitiesValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BatchAccountIdentityUserAssignedIdentitiesValue class. + /// + /// The principal id of user assigned + /// identity. + /// The client id of user assigned + /// identity. + public BatchAccountIdentityUserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchPoolIdentity.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchPoolIdentity.cs new file mode 100644 index 0000000000000..46345b4ed457d --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchPoolIdentity.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Batch.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The identity of the Batch pool, if configured. If the pool identity is + /// updated during update an existing pool, only the new vms which are + /// created after the pool shrinks to 0 will have the updated identities + /// + public partial class BatchPoolIdentity + { + /// + /// Initializes a new instance of the BatchPoolIdentity class. + /// + public BatchPoolIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchPoolIdentity class. + /// + /// The type of identity used for the Batch Pool. + /// Possible values include: 'UserAssigned', 'None' + /// The list of user identities + /// associated with the Batch pool. The user identity dictionary key + /// references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public BatchPoolIdentity(PoolIdentityType type, IDictionary userAssignedIdentities = default(IDictionary)) + { + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of identity used for the Batch Pool. Possible + /// values include: 'UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public PoolIdentityType Type { get; set; } + + /// + /// Gets or sets the list of user identities associated with the Batch + /// pool. The user identity dictionary key references will be ARM + /// resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchPoolIdentityUserAssignedIdentitiesValue.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchPoolIdentityUserAssignedIdentitiesValue.cs new file mode 100644 index 0000000000000..2773c9eac2d2f --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/BatchPoolIdentityUserAssignedIdentitiesValue.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Batch.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class BatchPoolIdentityUserAssignedIdentitiesValue + { + /// + /// Initializes a new instance of the + /// BatchPoolIdentityUserAssignedIdentitiesValue class. + /// + public BatchPoolIdentityUserAssignedIdentitiesValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BatchPoolIdentityUserAssignedIdentitiesValue class. + /// + /// The principal id of user assigned + /// identity. + /// The client id of user assigned + /// identity. + public BatchPoolIdentityUserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/FixedScaleSettings.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/FixedScaleSettings.cs index 229fab3c66e77..419294256fa93 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/FixedScaleSettings.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/FixedScaleSettings.cs @@ -33,8 +33,8 @@ public FixedScaleSettings() /// nodes to the pool. /// The desired number of dedicated /// compute nodes in the pool. - /// The desired number of - /// low-priority compute nodes in the pool. + /// The desired number of low + /// priority compute nodes in the pool. /// Determines what to do with a /// node and its running task(s) if the pool size is /// decreasing. @@ -78,7 +78,7 @@ public FixedScaleSettings() public int? TargetDedicatedNodes { get; set; } /// - /// Gets or sets the desired number of low-priority compute nodes in + /// Gets or sets the desired number of low priority compute nodes in /// the pool. /// /// diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/NodePlacementConfiguration.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/NodePlacementConfiguration.cs new file mode 100644 index 0000000000000..1354bd781d050 --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/NodePlacementConfiguration.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Batch.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Node placement configuration for batch pools. + /// + /// + /// Allocation configuration used by Batch Service to provision the nodes. + /// + public partial class NodePlacementConfiguration + { + /// + /// Initializes a new instance of the NodePlacementConfiguration class. + /// + public NodePlacementConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodePlacementConfiguration class. + /// + /// Node placement Policy type on Batch + /// Pools. + public NodePlacementConfiguration(NodePlacementPolicyType? policy = default(NodePlacementPolicyType?)) + { + Policy = policy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets node placement Policy type on Batch Pools. + /// + /// + /// Allocation policy used by Batch Service to provision the nodes. If + /// not specified, Batch will use the regional policy. Possible values + /// include: 'Regional', 'Zonal' + /// + [JsonProperty(PropertyName = "policy")] + public NodePlacementPolicyType? Policy { get; set; } + + } +} diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/NodePlacementPolicyType.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/NodePlacementPolicyType.cs new file mode 100644 index 0000000000000..9391e6c627fad --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/NodePlacementPolicyType.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Batch.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for NodePlacementPolicyType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NodePlacementPolicyType + { + /// + /// All nodes in the pool will be allocated in the same region. + /// + [EnumMember(Value = "Regional")] + Regional, + /// + /// Nodes in the pool will be spread across different zones with best + /// effort balancing. + /// + [EnumMember(Value = "Zonal")] + Zonal + } + internal static class NodePlacementPolicyTypeEnumExtension + { + internal static string ToSerializedValue(this NodePlacementPolicyType? value) + { + return value == null ? null : ((NodePlacementPolicyType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this NodePlacementPolicyType value) + { + switch( value ) + { + case NodePlacementPolicyType.Regional: + return "Regional"; + case NodePlacementPolicyType.Zonal: + return "Zonal"; + } + return null; + } + + internal static NodePlacementPolicyType? ParseNodePlacementPolicyType(this string value) + { + switch( value ) + { + case "Regional": + return NodePlacementPolicyType.Regional; + case "Zonal": + return NodePlacementPolicyType.Zonal; + } + return null; + } + } +} diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/Pool.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/Pool.cs index eef1c00cb9539..823576f2f1696 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/Pool.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/Pool.cs @@ -89,7 +89,9 @@ public Pool() /// current or last completed resize operation. /// A list of file systems to mount on /// each node in the pool. - public Pool(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string displayName = default(string), System.DateTime? lastModified = default(System.DateTime?), System.DateTime? creationTime = default(System.DateTime?), PoolProvisioningState? provisioningState = default(PoolProvisioningState?), System.DateTime? provisioningStateTransitionTime = default(System.DateTime?), AllocationState? allocationState = default(AllocationState?), System.DateTime? allocationStateTransitionTime = default(System.DateTime?), string vmSize = default(string), DeploymentConfiguration deploymentConfiguration = default(DeploymentConfiguration), int? currentDedicatedNodes = default(int?), int? currentLowPriorityNodes = default(int?), ScaleSettings scaleSettings = default(ScaleSettings), AutoScaleRun autoScaleRun = default(AutoScaleRun), InterNodeCommunicationState? interNodeCommunication = default(InterNodeCommunicationState?), NetworkConfiguration networkConfiguration = default(NetworkConfiguration), int? taskSlotsPerNode = default(int?), TaskSchedulingPolicy taskSchedulingPolicy = default(TaskSchedulingPolicy), IList userAccounts = default(IList), IList metadata = default(IList), StartTask startTask = default(StartTask), IList certificates = default(IList), IList applicationPackages = default(IList), IList applicationLicenses = default(IList), ResizeOperationStatus resizeOperationStatus = default(ResizeOperationStatus), IList mountConfiguration = default(IList)) + /// The type of identity used for the Batch + /// Pool. + public Pool(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string displayName = default(string), System.DateTime? lastModified = default(System.DateTime?), System.DateTime? creationTime = default(System.DateTime?), PoolProvisioningState? provisioningState = default(PoolProvisioningState?), System.DateTime? provisioningStateTransitionTime = default(System.DateTime?), AllocationState? allocationState = default(AllocationState?), System.DateTime? allocationStateTransitionTime = default(System.DateTime?), string vmSize = default(string), DeploymentConfiguration deploymentConfiguration = default(DeploymentConfiguration), int? currentDedicatedNodes = default(int?), int? currentLowPriorityNodes = default(int?), ScaleSettings scaleSettings = default(ScaleSettings), AutoScaleRun autoScaleRun = default(AutoScaleRun), InterNodeCommunicationState? interNodeCommunication = default(InterNodeCommunicationState?), NetworkConfiguration networkConfiguration = default(NetworkConfiguration), int? taskSlotsPerNode = default(int?), TaskSchedulingPolicy taskSchedulingPolicy = default(TaskSchedulingPolicy), IList userAccounts = default(IList), IList metadata = default(IList), StartTask startTask = default(StartTask), IList certificates = default(IList), IList applicationPackages = default(IList), IList applicationLicenses = default(IList), ResizeOperationStatus resizeOperationStatus = default(ResizeOperationStatus), IList mountConfiguration = default(IList), BatchPoolIdentity identity = default(BatchPoolIdentity)) : base(id, name, type, etag) { DisplayName = displayName; @@ -117,6 +119,7 @@ public Pool() ApplicationLicenses = applicationLicenses; ResizeOperationStatus = resizeOperationStatus; MountConfiguration = mountConfiguration; + Identity = identity; CustomInit(); } @@ -379,6 +382,15 @@ public Pool() [JsonProperty(PropertyName = "properties.mountConfiguration")] public IList MountConfiguration { get; set; } + /// + /// Gets or sets the type of identity used for the Batch Pool. + /// + /// + /// The type of identity used for the Batch Pool. + /// + [JsonProperty(PropertyName = "identity")] + public BatchPoolIdentity Identity { get; set; } + /// /// Validate the object. /// @@ -461,6 +473,10 @@ public virtual void Validate() } } } + if (Identity != null) + { + Identity.Validate(); + } } } } diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/PoolIdentityType.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/PoolIdentityType.cs new file mode 100644 index 0000000000000..acad2e1bf4bdb --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/PoolIdentityType.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Batch.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for PoolIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PoolIdentityType + { + /// + /// Batch pool has user assigned identities with it. + /// + [EnumMember(Value = "UserAssigned")] + UserAssigned, + /// + /// Batch pool has no identity associated with it. Setting `None` in + /// update pool will remove existing identities. + /// + [EnumMember(Value = "None")] + None + } + internal static class PoolIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this PoolIdentityType? value) + { + return value == null ? null : ((PoolIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this PoolIdentityType value) + { + switch( value ) + { + case PoolIdentityType.UserAssigned: + return "UserAssigned"; + case PoolIdentityType.None: + return "None"; + } + return null; + } + + internal static PoolIdentityType? ParsePoolIdentityType(this string value) + { + switch( value ) + { + case "UserAssigned": + return PoolIdentityType.UserAssigned; + case "None": + return PoolIdentityType.None; + } + return null; + } + } +} diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResizeOperationStatus.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResizeOperationStatus.cs index 1643c6a06e84e..b7a9f8169cf29 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResizeOperationStatus.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResizeOperationStatus.cs @@ -38,8 +38,8 @@ public ResizeOperationStatus() /// /// The desired number of dedicated /// compute nodes in the pool. - /// The desired number of - /// low-priority compute nodes in the pool. + /// The desired number of low + /// priority compute nodes in the pool. /// The timeout for allocation of compute /// nodes to the pool or removal of compute nodes from the /// pool. @@ -74,7 +74,7 @@ public ResizeOperationStatus() public int? TargetDedicatedNodes { get; set; } /// - /// Gets or sets the desired number of low-priority compute nodes in + /// Gets or sets the desired number of low priority compute nodes in /// the pool. /// [JsonProperty(PropertyName = "targetLowPriorityNodes")] diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResourceIdentityType.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResourceIdentityType.cs index 8fdd728b85f36..a14c60f640ada 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResourceIdentityType.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/ResourceIdentityType.cs @@ -27,6 +27,11 @@ public enum ResourceIdentityType [EnumMember(Value = "SystemAssigned")] SystemAssigned, /// + /// Batch account has user assigned identities with it. + /// + [EnumMember(Value = "UserAssigned")] + UserAssigned, + /// /// Batch account has no identity associated with it. Setting `None` in /// update account will remove existing identities. /// @@ -46,6 +51,8 @@ internal static string ToSerializedValue(this ResourceIdentityType value) { case ResourceIdentityType.SystemAssigned: return "SystemAssigned"; + case ResourceIdentityType.UserAssigned: + return "UserAssigned"; case ResourceIdentityType.None: return "None"; } @@ -58,6 +65,8 @@ internal static string ToSerializedValue(this ResourceIdentityType value) { case "SystemAssigned": return ResourceIdentityType.SystemAssigned; + case "UserAssigned": + return ResourceIdentityType.UserAssigned; case "None": return ResourceIdentityType.None; } diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/VMExtension.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/VMExtension.cs new file mode 100644 index 0000000000000..658df296b517c --- /dev/null +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/VMExtension.cs @@ -0,0 +1,150 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Batch.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The configuration for virtual machine extensions. + /// + public partial class VMExtension + { + /// + /// Initializes a new instance of the VMExtension class. + /// + public VMExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMExtension class. + /// + /// The name of the virtual machine + /// extension. + /// The name of the extension handler + /// publisher. + /// The type of the extensions. + /// The version of script + /// handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// JSON formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// The collection of extension + /// names. + public VMExtension(string name, string publisher, string type, string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), object settings = default(object), object protectedSettings = default(object), IList provisionAfterExtensions = default(IList)) + { + Name = name; + Publisher = publisher; + Type = type; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisionAfterExtensions = provisionAfterExtensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the virtual machine extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the type of the extensions. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the version of script handler. + /// + [JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets JSON formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets or sets the collection of extension names. + /// + /// + /// Collection of extension names after which this extension needs to + /// be provisioned. + /// + [JsonProperty(PropertyName = "provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/VirtualMachineConfiguration.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/VirtualMachineConfiguration.cs index cbfb8b04727d1..d59ae0e4d8457 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/VirtualMachineConfiguration.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/Models/VirtualMachineConfiguration.cs @@ -50,7 +50,11 @@ public VirtualMachineConfiguration() /// for the pool. /// The disk encryption /// configuration for the pool. - public VirtualMachineConfiguration(ImageReference imageReference, string nodeAgentSkuId, WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), IList dataDisks = default(IList), string licenseType = default(string), ContainerConfiguration containerConfiguration = default(ContainerConfiguration), DiskEncryptionConfiguration diskEncryptionConfiguration = default(DiskEncryptionConfiguration)) + /// The node placement + /// configuration for the pool. + /// The virtual machine extension for the + /// pool. + public VirtualMachineConfiguration(ImageReference imageReference, string nodeAgentSkuId, WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), IList dataDisks = default(IList), string licenseType = default(string), ContainerConfiguration containerConfiguration = default(ContainerConfiguration), DiskEncryptionConfiguration diskEncryptionConfiguration = default(DiskEncryptionConfiguration), NodePlacementConfiguration nodePlacementConfiguration = default(NodePlacementConfiguration), IList extensions = default(IList)) { ImageReference = imageReference; NodeAgentSkuId = nodeAgentSkuId; @@ -59,6 +63,8 @@ public VirtualMachineConfiguration() LicenseType = licenseType; ContainerConfiguration = containerConfiguration; DiskEncryptionConfiguration = diskEncryptionConfiguration; + NodePlacementConfiguration = nodePlacementConfiguration; + Extensions = extensions; CustomInit(); } @@ -152,6 +158,26 @@ public VirtualMachineConfiguration() [JsonProperty(PropertyName = "diskEncryptionConfiguration")] public DiskEncryptionConfiguration DiskEncryptionConfiguration { get; set; } + /// + /// Gets or sets the node placement configuration for the pool. + /// + /// + /// This configuration will specify rules on how nodes in the pool will + /// be physically allocated. + /// + [JsonProperty(PropertyName = "nodePlacementConfiguration")] + public NodePlacementConfiguration NodePlacementConfiguration { get; set; } + + /// + /// Gets or sets the virtual machine extension for the pool. + /// + /// + /// If specified, the extensions mentioned in this configuration will + /// be installed on each node. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + /// /// Validate the object. /// @@ -178,6 +204,16 @@ public virtual void Validate() } } } + if (Extensions != null) + { + foreach (var element1 in Extensions) + { + if (element1 != null) + { + element1.Validate(); + } + } + } } } } diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperations.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperations.cs index ce5e61ad249c7..b6b9fff5cc069 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperations.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperations.cs @@ -324,39 +324,6 @@ internal PoolOperations(BatchManagementClient client) /// existing pool. Other values will be ignored. /// /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updates the properties of an existing pool. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The pool name. This must be unique within the account. - /// - /// - /// Pool properties that should be updated. Properties that are supplied will - /// be updated, any property not supplied will be unchanged. - /// - /// - /// The entity state (ETag) version of the pool to update. This value can be - /// omitted or set to "*" to apply the operation unconditionally. - /// - /// /// Headers that will be added to request. /// /// @@ -377,7 +344,7 @@ internal PoolOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -425,6 +392,10 @@ internal PoolOperations(BatchManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -445,8 +416,9 @@ internal PoolOperations(BatchManagementClient client) tracingParameters.Add("poolName", poolName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -467,7 +439,7 @@ internal PoolOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -482,6 +454,14 @@ internal PoolOperations(BatchManagementClient client) } _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); } + if (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) @@ -567,7 +547,7 @@ internal PoolOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -594,7 +574,7 @@ internal PoolOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -613,7 +593,7 @@ internal PoolOperations(BatchManagementClient client) } /// - /// Deletes the specified pool. + /// Updates the properties of an existing pool. /// /// /// The name of the resource group that contains the Batch account. @@ -624,30 +604,13 @@ internal PoolOperations(BatchManagementClient client) /// /// The pool name. This must be unique within the account. /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets information about the specified pool. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. + /// + /// Pool properties that should be updated. Properties that are supplied will + /// be updated, any property not supplied will be unchanged. /// - /// - /// The pool name. This must be unique within the account. + /// + /// The entity state (ETag) version of the pool to update. This value can be + /// omitted or set to "*" to apply the operation unconditionally. /// /// /// Headers that will be added to request. @@ -670,7 +633,7 @@ internal PoolOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -714,6 +677,10 @@ internal PoolOperations(BatchManagementClient client) throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); } } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -732,8 +699,10 @@ internal PoolOperations(BatchManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -754,13 +723,21 @@ internal PoolOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) @@ -785,6 +762,12 @@ internal PoolOperations(BatchManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -840,7 +823,7 @@ internal PoolOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -867,7 +850,7 @@ internal PoolOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -886,7 +869,32 @@ internal PoolOperations(BatchManagementClient client) } /// - /// Disables automatic scaling for a pool. + /// Deletes the specified pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified pool. /// /// /// The name of the resource group that contains the Batch account. @@ -918,7 +926,7 @@ internal PoolOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DisableAutoScaleWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -981,11 +989,11 @@ internal PoolOperations(BatchManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DisableAutoScale", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); @@ -1002,7 +1010,7 @@ internal PoolOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1088,7 +1096,7 @@ internal PoolOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1115,7 +1123,7 @@ internal PoolOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -1134,18 +1142,8 @@ internal PoolOperations(BatchManagementClient client) } /// - /// Stops an ongoing resize operation on the pool. + /// Disables automatic scaling for a pool. /// - /// - /// This does not restore the pool to its previous state before the resize - /// operation: it only stops any further changes being made, and the pool - /// maintains its current state. After stopping, the pool stabilizes at the - /// number of nodes it was at when the stop operation was done. During the stop - /// operation, the pool allocation state changes first to stopping and then to - /// steady. A resize operation need not be an explicit resize pool request; - /// this API can also be used to halt the initial sizing of the pool when it is - /// created. - /// /// /// The name of the resource group that contains the Batch account. /// @@ -1176,7 +1174,7 @@ internal PoolOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> StopResizeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DisableAutoScaleWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1239,11 +1237,11 @@ internal PoolOperations(BatchManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "StopResize", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DisableAutoScale", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); @@ -1346,7 +1344,7 @@ internal PoolOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1373,7 +1371,7 @@ internal PoolOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -1392,8 +1390,18 @@ internal PoolOperations(BatchManagementClient client) } /// - /// Creates a new pool inside the specified account. + /// Stops an ongoing resize operation on the pool. /// + /// + /// This does not restore the pool to its previous state before the resize + /// operation: it only stops any further changes being made, and the pool + /// maintains its current state. After stopping, the pool stabilizes at the + /// number of nodes it was at when the stop operation was done. During the stop + /// operation, the pool allocation state changes first to stopping and then to + /// steady. A resize operation need not be an explicit resize pool request; + /// this API can also be used to halt the initial sizing of the pool when it is + /// created. + /// /// /// The name of the resource group that contains the Batch account. /// @@ -1403,18 +1411,6 @@ internal PoolOperations(BatchManagementClient client) /// /// The pool name. This must be unique within the account. /// - /// - /// Additional parameters for pool creation. - /// - /// - /// The entity state (ETag) version of the pool to update. A value of "*" can - /// be used to apply the operation only if the pool already exists. If omitted, - /// this operation will always be applied. - /// - /// - /// Set to '*' to allow a new pool to be created, but to prevent updating an - /// existing pool. Other values will be ignored. - /// /// /// Headers that will be added to request. /// @@ -1436,7 +1432,7 @@ internal PoolOperations(BatchManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> StopResizeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1480,14 +1476,6 @@ internal PoolOperations(BatchManagementClient client) throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); } } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1506,15 +1494,12 @@ internal PoolOperations(BatchManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("ifNoneMatch", ifNoneMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "StopResize", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); @@ -1531,29 +1516,13 @@ internal PoolOperations(BatchManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (ifMatch != null) - { - if (_httpRequest.Headers.Contains("If-Match")) - { - _httpRequest.Headers.Remove("If-Match"); - } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); - } - if (ifNoneMatch != null) - { - if (_httpRequest.Headers.Contains("If-None-Match")) - { - _httpRequest.Headers.Remove("If-None-Match"); - } - _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); - } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) @@ -1578,12 +1547,6 @@ internal PoolOperations(BatchManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1639,7 +1602,7 @@ internal PoolOperations(BatchManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1666,7 +1629,7 @@ internal PoolOperations(BatchManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperationsExtensions.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperationsExtensions.cs index 2113124605e79..c3201913ded91 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperationsExtensions.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/PoolOperationsExtensions.cs @@ -443,76 +443,6 @@ public static Pool StopResize(this IPoolOperations operations, string resourceGr } } - /// - /// Creates a new pool inside the specified account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The pool name. This must be unique within the account. - /// - /// - /// Additional parameters for pool creation. - /// - /// - /// The entity state (ETag) version of the pool to update. A value of "*" can - /// be used to apply the operation only if the pool already exists. If omitted, - /// this operation will always be applied. - /// - /// - /// Set to '*' to allow a new pool to be created, but to prevent updating an - /// existing pool. Other values will be ignored. - /// - public static Pool BeginCreate(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) - { - return operations.BeginCreateAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); - } - - /// - /// Creates a new pool inside the specified account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the Batch account. - /// - /// - /// The name of the Batch account. - /// - /// - /// The pool name. This must be unique within the account. - /// - /// - /// Additional parameters for pool creation. - /// - /// - /// The entity state (ETag) version of the pool to update. A value of "*" can - /// be used to apply the operation only if the pool already exists. If omitted, - /// this operation will always be applied. - /// - /// - /// Set to '*' to allow a new pool to be created, but to prevent updating an - /// existing pool. Other values will be ignored. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Deletes the specified pool. /// diff --git a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/SdkInfo_BatchManagement.cs b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/SdkInfo_BatchManagement.cs index ec73b068a1128..ee825d5aefe02 100644 --- a/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/SdkInfo_BatchManagement.cs +++ b/sdk/batch/Microsoft.Azure.Management.Batch/src/Generated/SdkInfo_BatchManagement.cs @@ -19,28 +19,17 @@ public static IEnumerable> ApiInfo_BatchManagement { return new Tuple[] { - new Tuple("Batch", "Application", "2020-09-01"), - new Tuple("Batch", "ApplicationPackage", "2020-09-01"), - new Tuple("Batch", "BatchAccount", "2020-09-01"), - new Tuple("Batch", "Certificate", "2020-09-01"), - new Tuple("Batch", "Location", "2020-09-01"), - new Tuple("Batch", "Operations", "2020-09-01"), - new Tuple("Batch", "Pool", "2020-09-01"), - new Tuple("Batch", "PrivateEndpointConnection", "2020-09-01"), - new Tuple("Batch", "PrivateLinkResource", "2020-09-01"), + new Tuple("Batch", "Application", "2021-01-01"), + new Tuple("Batch", "ApplicationPackage", "2021-01-01"), + new Tuple("Batch", "BatchAccount", "2021-01-01"), + new Tuple("Batch", "Certificate", "2021-01-01"), + new Tuple("Batch", "Location", "2021-01-01"), + new Tuple("Batch", "Operations", "2021-01-01"), + new Tuple("Batch", "Pool", "2021-01-01"), + new Tuple("Batch", "PrivateEndpointConnection", "2021-01-01"), + new Tuple("Batch", "PrivateLinkResource", "2021-01-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/batch/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=E:\\Github\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "0ac9e064be76262b2625a0b5be1a0cc8b9b272fa"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -