diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRoleInstancesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRoleInstancesOperations.cs new file mode 100644 index 0000000000000..f5b2de88542bb --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRoleInstancesOperations.cs @@ -0,0 +1,1855 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRoleInstancesOperations operations. + /// + internal partial class CloudServiceRoleInstancesOperations : IServiceOperations, ICloudServiceRoleInstancesOperations + { + /// + /// Initializes a new instance of the CloudServiceRoleInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServiceRoleInstancesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values include: + /// 'instanceView' + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves information about the run-time state of a role instance in a + /// cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetInstanceViewWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetInstanceView", 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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values include: + /// 'instanceView' + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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.Compute/cloudServices/{cloudServiceName}/roleInstances").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRebuildWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetRemoteDesktopFileWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRemoteDesktopFile", 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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", 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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", 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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRebuild", 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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRoleInstancesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRoleInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..b629a041cd9b8 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRoleInstancesOperationsExtensions.cs @@ -0,0 +1,579 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServiceRoleInstancesOperations. + /// + public static partial class CloudServiceRoleInstancesOperationsExtensions + { + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void Delete(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.DeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values include: + /// 'instanceView' + /// + public static RoleInstance Get(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about the run-time state of a role instance in a + /// cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static RoleInstanceInstanceView GetInstanceView(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + return operations.GetInstanceViewAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about the run-time state of a role instance in a + /// cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values include: + /// 'instanceView' + /// + public static IPage List(this ICloudServiceRoleInstancesOperations operations, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.ListAsync(resourceGroupName, cloudServiceName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICloudServiceRoleInstancesOperations operations, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, cloudServiceName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void Restart(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.RestartAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void Reimage(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.ReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void Rebuild(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.RebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task RebuildAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RebuildWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static Stream GetRemoteDesktopFile(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + return operations.GetRemoteDesktopFileAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetRemoteDesktopFileAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.GetRemoteDesktopFileWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false); + _result.Request.Dispose(); + return _result.Body; + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void BeginDelete(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginDeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void BeginRestart(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginRestartAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void BeginReimage(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + public static void BeginRebuild(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginRebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginRebuildAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRebuildWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICloudServiceRoleInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICloudServiceRoleInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRolesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRolesOperations.cs new file mode 100644 index 0000000000000..4f89d31c68754 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRolesOperations.cs @@ -0,0 +1,624 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRolesOperations operations. + /// + internal partial class CloudServiceRolesOperations : IServiceOperations, ICloudServiceRolesOperations + { + /// + /// Initializes a new instance of the CloudServiceRolesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServiceRolesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets a role from a cloud service. + /// + /// + /// Name of the role. + /// + /// + /// + /// + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string roleName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleName", roleName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Compute/cloudServices/{cloudServiceName}/roles/{roleName}").ToString(); + _url = _url.Replace("{roleName}", System.Uri.EscapeDataString(roleName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// + /// + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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.Compute/cloudServices/{cloudServiceName}/roles").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRolesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRolesOperationsExtensions.cs new file mode 100644 index 0000000000000..5e85be38ce4a5 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServiceRolesOperationsExtensions.cs @@ -0,0 +1,145 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServiceRolesOperations. + /// + public static partial class CloudServiceRolesOperationsExtensions + { + /// + /// Gets a role from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role. + /// + /// + /// + /// + /// + public static CloudServiceRole Get(this ICloudServiceRolesOperations operations, string roleName, string resourceGroupName, string cloudServiceName) + { + return operations.GetAsync(roleName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a role from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICloudServiceRolesOperations operations, string roleName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(roleName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static IPage List(this ICloudServiceRolesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.ListAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICloudServiceRolesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICloudServiceRolesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICloudServiceRolesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesOperations.cs new file mode 100644 index 0000000000000..cfad17514e220 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesOperations.cs @@ -0,0 +1,3122 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesOperations operations. + /// + internal partial class CloudServicesOperations : IServiceOperations, ICloudServicesOperations + { + /// + /// Initializes a new instance of the CloudServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServicesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Display information about a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the status of a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetInstanceView", 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.Compute/cloudServices/{cloudServiceName}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// Name of the resource group. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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.Compute/cloudServices").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRebuildWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + CloudServiceUpdate parameters = default(CloudServiceUpdate); + if (tags != null) + { + parameters = new CloudServiceUpdate(); + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", 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.Compute/cloudServices/{cloudServiceName}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPowerOff", 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.Compute/cloudServices/{cloudServiceName}/poweroff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2020-10-01-preview"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", 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.Compute/cloudServices/{cloudServiceName}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2020-10-01-preview"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", 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.Compute/cloudServices/{cloudServiceName}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2020-10-01-preview"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRebuild", 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.Compute/cloudServices/{cloudServiceName}/rebuild").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2020-10-01-preview"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteInstances", 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.Compute/cloudServices/{cloudServiceName}/delete").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesOperationsExtensions.cs new file mode 100644 index 0000000000000..84568a13d4c19 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesOperationsExtensions.cs @@ -0,0 +1,1047 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServicesOperations. + /// + public static partial class CloudServicesOperationsExtensions + { + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + public static CloudService CreateOrUpdate(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + public static CloudService Update(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, cloudServiceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Delete(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.DeleteAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Display information about a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static CloudService Get(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.GetAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Display information about a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the status of a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static CloudServiceInstanceView GetInstanceView(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.GetInstanceViewAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListAll(this ICloudServicesOperations operations) + { + return operations.ListAllAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this ICloudServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + public static IPage List(this ICloudServicesOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICloudServicesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Start(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.StartAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void PowerOff(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.PowerOffAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void Restart(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.RestartAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void Reimage(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.ReimageAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void Rebuild(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.RebuildAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task RebuildAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RebuildWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void DeleteInstances(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.DeleteInstancesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInstancesAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteInstancesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + public static CloudService BeginCreateOrUpdate(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + public static CloudService BeginUpdate(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, cloudServiceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginDelete(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.BeginDeleteAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginStart(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.BeginStartAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginPowerOff(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.BeginPowerOffAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginRestart(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginRestartAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginReimage(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginReimageAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginRebuild(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginRebuildAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRebuildAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRebuildWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginDeleteInstances(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginDeleteInstancesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteInstancesAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this ICloudServicesOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllNextAsync(this ICloudServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICloudServicesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICloudServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesUpdateDomainOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesUpdateDomainOperations.cs new file mode 100644 index 0000000000000..be13c0980ab6a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesUpdateDomainOperations.cs @@ -0,0 +1,839 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesUpdateDomainOperations operations. + /// + internal partial class CloudServicesUpdateDomainOperations : IServiceOperations, ICloudServicesUpdateDomainOperations + { + /// + /// Initializes a new instance of the CloudServicesUpdateDomainOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServicesUpdateDomainOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task WalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginWalkUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified update domain of a cloud service. Use nextLink property + /// in the response to get the next page of update domains. Do this till + /// nextLink is null to fetch all the update domains. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("updateDomain", updateDomain); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetUpdateDomain", 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.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{updateDomain}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(updateDomain, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListUpdateDomainsWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListUpdateDomains", 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.Compute/cloudServices/{cloudServiceName}/updateDomains").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginWalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01-preview"; + UpdateDomain parameters = default(UpdateDomain); + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("updateDomain", updateDomain); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginWalkUpdateDomain", 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.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{updateDomain}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(updateDomain, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListUpdateDomainsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListUpdateDomainsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesUpdateDomainOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesUpdateDomainOperationsExtensions.cs new file mode 100644 index 0000000000000..9e3226415fe15 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CloudServicesUpdateDomainOperationsExtensions.cs @@ -0,0 +1,247 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServicesUpdateDomainOperations. + /// + public static partial class CloudServicesUpdateDomainOperationsExtensions + { + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + public static void WalkUpdateDomain(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain) + { + operations.WalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain).GetAwaiter().GetResult(); + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The cancellation token. + /// + public static async Task WalkUpdateDomainAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.WalkUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the specified update domain of a cloud service. Use nextLink property + /// in the response to get the next page of update domains. Do this till + /// nextLink is null to fetch all the update domains. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + public static UpdateDomain GetUpdateDomain(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain) + { + return operations.GetUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified update domain of a cloud service. Use nextLink property + /// in the response to get the next page of update domains. Do this till + /// nextLink is null to fetch all the update domains. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The cancellation token. + /// + public static async Task GetUpdateDomainAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static IPage ListUpdateDomains(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.ListUpdateDomainsAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListUpdateDomainsAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListUpdateDomainsWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + public static void BeginWalkUpdateDomain(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain) + { + operations.BeginWalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain).GetAwaiter().GetResult(); + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The cancellation token. + /// + public static async Task BeginWalkUpdateDomainAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginWalkUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListUpdateDomainsNext(this ICloudServicesUpdateDomainOperations operations, string nextPageLink) + { + return operations.ListUpdateDomainsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListUpdateDomainsNextAsync(this ICloudServicesUpdateDomainOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListUpdateDomainsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs index 7bab34599755d..71a588b2c8465 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs @@ -226,11 +226,51 @@ public partial class ComputeManagementClient : ServiceClient public virtual IGalleryApplicationVersionsOperations GalleryApplicationVersions { get; private set; } + /// + /// Gets the IGallerySharingProfileOperations. + /// + public virtual IGallerySharingProfileOperations GallerySharingProfile { get; private set; } + + /// + /// Gets the ISharedGalleriesOperations. + /// + public virtual ISharedGalleriesOperations SharedGalleries { get; private set; } + + /// + /// Gets the ISharedGalleryImagesOperations. + /// + public virtual ISharedGalleryImagesOperations SharedGalleryImages { get; private set; } + + /// + /// Gets the ISharedGalleryImageVersionsOperations. + /// + public virtual ISharedGalleryImageVersionsOperations SharedGalleryImageVersions { get; private set; } + /// /// Gets the IContainerServicesOperations. /// public virtual IContainerServicesOperations ContainerServices { get; private set; } + /// + /// Gets the ICloudServiceRoleInstancesOperations. + /// + public virtual ICloudServiceRoleInstancesOperations CloudServiceRoleInstances { get; private set; } + + /// + /// Gets the ICloudServiceRolesOperations. + /// + public virtual ICloudServiceRolesOperations CloudServiceRoles { get; private set; } + + /// + /// Gets the ICloudServicesOperations. + /// + public virtual ICloudServicesOperations CloudServices { get; private set; } + + /// + /// Gets the ICloudServicesUpdateDomainOperations. + /// + public virtual ICloudServicesUpdateDomainOperations CloudServicesUpdateDomain { get; private set; } + /// /// Initializes a new instance of the ComputeManagementClient class. /// @@ -503,7 +543,15 @@ private void Initialize() GalleryImageVersions = new GalleryImageVersionsOperations(this); GalleryApplications = new GalleryApplicationsOperations(this); GalleryApplicationVersions = new GalleryApplicationVersionsOperations(this); + GallerySharingProfile = new GallerySharingProfileOperations(this); + SharedGalleries = new SharedGalleriesOperations(this); + SharedGalleryImages = new SharedGalleryImagesOperations(this); + SharedGalleryImageVersions = new SharedGalleryImageVersionsOperations(this); ContainerServices = new ContainerServicesOperations(this); + CloudServiceRoleInstances = new CloudServiceRoleInstancesOperations(this); + CloudServiceRoles = new CloudServiceRolesOperations(this); + CloudServices = new CloudServicesOperations(this); + CloudServicesUpdateDomain = new CloudServicesUpdateDomainOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs index 26c248d669a73..cd1041750010d 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs @@ -113,6 +113,10 @@ internal GalleriesOperations(ComputeManagementClient client) /// /// The name of the Shared Image Gallery. /// + /// + /// The select expression to apply on the operation. Possible values include: + /// 'Permissions' + /// /// /// Headers that will be added to request. /// @@ -134,7 +138,7 @@ internal GalleriesOperations(ComputeManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -148,7 +152,7 @@ internal GalleriesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -159,6 +163,7 @@ internal GalleriesOperations(ComputeManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("galleryName", galleryName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("select", select); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -173,6 +178,10 @@ internal GalleriesOperations(ComputeManagementClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -357,7 +366,7 @@ internal GalleriesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -535,7 +544,7 @@ internal GalleriesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -738,7 +747,7 @@ internal GalleriesOperations(ComputeManagementClient client) { gallery.Validate(); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -984,7 +993,7 @@ internal GalleriesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "gallery"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1182,7 +1191,7 @@ internal GalleriesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs index 200ecf5072b82..d5c55ace52ecd 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs @@ -133,9 +133,13 @@ public static Gallery Update(this IGalleriesOperations operations, string resour /// /// The name of the Shared Image Gallery. /// - public static Gallery Get(this IGalleriesOperations operations, string resourceGroupName, string galleryName) + /// + /// The select expression to apply on the operation. Possible values include: + /// 'Permissions' + /// + public static Gallery Get(this IGalleriesOperations operations, string resourceGroupName, string galleryName, string select = default(string)) { - return operations.GetAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, galleryName, select).GetAwaiter().GetResult(); } /// @@ -150,12 +154,16 @@ public static Gallery Get(this IGalleriesOperations operations, string resourceG /// /// The name of the Shared Image Gallery. /// + /// + /// The select expression to apply on the operation. Possible values include: + /// 'Permissions' + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, select, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperations.cs index 5ee6cdad2a4f7..7fee20b39f3ce 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperations.cs @@ -187,7 +187,7 @@ internal GalleryApplicationVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -429,7 +429,7 @@ internal GalleryApplicationVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -656,7 +656,7 @@ internal GalleryApplicationVersionsOperations(ComputeManagementClient client) { galleryApplicationVersion.Validate(); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -923,7 +923,7 @@ internal GalleryApplicationVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersion"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1141,7 +1141,7 @@ internal GalleryApplicationVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperations.cs index 1d36b379d0e58..ee8bf60a5e4ef 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperations.cs @@ -164,7 +164,7 @@ internal GalleryApplicationsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -387,7 +387,7 @@ internal GalleryApplicationsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -602,7 +602,7 @@ internal GalleryApplicationsOperations(ComputeManagementClient client) { galleryApplication.Validate(); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -858,7 +858,7 @@ internal GalleryApplicationsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplication"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1066,7 +1066,7 @@ internal GalleryApplicationsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperations.cs index 69cb3fd8df8c8..112a66063ee3b 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperations.cs @@ -51,7 +51,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) public ComputeManagementClient Client { get; private set; } /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The name of the resource group. @@ -60,17 +60,17 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be created. /// /// - /// The name of the gallery Image Version to be created. Needs to follow + /// The name of the gallery image version to be created. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// /// @@ -87,7 +87,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The name of the resource group. @@ -96,17 +96,17 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to follow + /// The name of the gallery image version to be updated. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// /// /// The headers that will be added to request. @@ -122,7 +122,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// Retrieves information about a gallery Image Version. + /// Retrieves information about a gallery image version. /// /// /// The name of the resource group. @@ -131,11 +131,11 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be retrieved. + /// The name of the gallery image version to be retrieved. /// /// /// The expand expression to apply on the operation. Possible values include: @@ -184,7 +184,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -344,7 +344,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The name of the resource group. @@ -353,11 +353,11 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// /// /// The headers that will be added to request. @@ -373,7 +373,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The name of the resource group. @@ -424,7 +424,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -577,7 +577,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The name of the resource group. @@ -586,17 +586,17 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be created. /// /// - /// The name of the gallery Image Version to be created. Needs to follow + /// The name of the gallery image version to be created. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// /// @@ -650,7 +650,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) { galleryImageVersion.Validate(); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -848,7 +848,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The name of the resource group. @@ -857,17 +857,17 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to follow + /// The name of the gallery image version to be updated. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// /// /// Headers that will be added to request. @@ -916,7 +916,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersion"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1078,7 +1078,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The name of the resource group. @@ -1087,11 +1087,11 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// /// /// Headers that will be added to request. @@ -1133,7 +1133,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1270,7 +1270,7 @@ internal GalleryImageVersionsOperations(ComputeManagementClient client) } /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperationsExtensions.cs index 7b915d62dfdfd..f77ed912503e0 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Compute public static partial class GalleryImageVersionsOperationsExtensions { /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The operations group for this extension method. @@ -34,17 +34,17 @@ public static partial class GalleryImageVersionsOperationsExtensions /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be created. /// /// - /// The name of the gallery Image Version to be created. Needs to follow + /// The name of the gallery image version to be created. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// public static GalleryImageVersion CreateOrUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion) @@ -53,7 +53,7 @@ public static GalleryImageVersion CreateOrUpdate(this IGalleryImageVersionsOpera } /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The operations group for this extension method. @@ -65,17 +65,17 @@ public static GalleryImageVersion CreateOrUpdate(this IGalleryImageVersionsOpera /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be created. /// /// - /// The name of the gallery Image Version to be created. Needs to follow + /// The name of the gallery image version to be created. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// /// @@ -90,7 +90,7 @@ public static GalleryImageVersion CreateOrUpdate(this IGalleryImageVersionsOpera } /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The operations group for this extension method. @@ -102,17 +102,17 @@ public static GalleryImageVersion CreateOrUpdate(this IGalleryImageVersionsOpera /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to follow + /// The name of the gallery image version to be updated. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// public static GalleryImageVersion Update(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion) { @@ -120,7 +120,7 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op } /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The operations group for this extension method. @@ -132,17 +132,17 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to follow + /// The name of the gallery image version to be updated. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// /// /// The cancellation token. @@ -156,7 +156,7 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op } /// - /// Retrieves information about a gallery Image Version. + /// Retrieves information about a gallery image version. /// /// /// The operations group for this extension method. @@ -168,11 +168,11 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be retrieved. + /// The name of the gallery image version to be retrieved. /// /// /// The expand expression to apply on the operation. Possible values include: @@ -184,7 +184,7 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op } /// - /// Retrieves information about a gallery Image Version. + /// Retrieves information about a gallery image version. /// /// /// The operations group for this extension method. @@ -196,11 +196,11 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be retrieved. + /// The name of the gallery image version to be retrieved. /// /// /// The expand expression to apply on the operation. Possible values include: @@ -218,7 +218,7 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op } /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The operations group for this extension method. @@ -230,11 +230,11 @@ public static GalleryImageVersion Update(this IGalleryImageVersionsOperations op /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// public static void Delete(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName) { @@ -242,7 +242,7 @@ public static void Delete(this IGalleryImageVersionsOperations operations, strin } /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The operations group for this extension method. @@ -254,11 +254,11 @@ public static void Delete(this IGalleryImageVersionsOperations operations, strin /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// /// /// The cancellation token. @@ -269,7 +269,7 @@ public static void Delete(this IGalleryImageVersionsOperations operations, strin } /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The operations group for this extension method. @@ -290,7 +290,7 @@ public static IPage ListByGalleryImage(this IGalleryImageVe } /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The operations group for this extension method. @@ -317,7 +317,7 @@ public static IPage ListByGalleryImage(this IGalleryImageVe } /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The operations group for this extension method. @@ -329,17 +329,17 @@ public static IPage ListByGalleryImage(this IGalleryImageVe /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be created. /// /// - /// The name of the gallery Image Version to be created. Needs to follow + /// The name of the gallery image version to be created. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// public static GalleryImageVersion BeginCreateOrUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion) @@ -348,7 +348,7 @@ public static GalleryImageVersion BeginCreateOrUpdate(this IGalleryImageVersions } /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The operations group for this extension method. @@ -360,17 +360,17 @@ public static GalleryImageVersion BeginCreateOrUpdate(this IGalleryImageVersions /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be created. /// /// - /// The name of the gallery Image Version to be created. Needs to follow + /// The name of the gallery image version to be created. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// /// @@ -385,7 +385,7 @@ public static GalleryImageVersion BeginCreateOrUpdate(this IGalleryImageVersions } /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The operations group for this extension method. @@ -397,17 +397,17 @@ public static GalleryImageVersion BeginCreateOrUpdate(this IGalleryImageVersions /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to follow + /// The name of the gallery image version to be updated. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// public static GalleryImageVersion BeginUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion) { @@ -415,7 +415,7 @@ public static GalleryImageVersion BeginUpdate(this IGalleryImageVersionsOperatio } /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The operations group for this extension method. @@ -427,17 +427,17 @@ public static GalleryImageVersion BeginUpdate(this IGalleryImageVersionsOperatio /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version is to + /// The name of the gallery image definition in which the Image Version is to /// be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to follow + /// The name of the gallery image version to be updated. Needs to follow /// semantic version name pattern: The allowed characters are digit and period. /// Digits must be within the range of a 32-bit integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// /// /// The cancellation token. @@ -451,7 +451,7 @@ public static GalleryImageVersion BeginUpdate(this IGalleryImageVersionsOperatio } /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The operations group for this extension method. @@ -463,11 +463,11 @@ public static GalleryImageVersion BeginUpdate(this IGalleryImageVersionsOperatio /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// public static void BeginDelete(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName) { @@ -475,7 +475,7 @@ public static void BeginDelete(this IGalleryImageVersionsOperations operations, } /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The operations group for this extension method. @@ -487,11 +487,11 @@ public static void BeginDelete(this IGalleryImageVersionsOperations operations, /// The name of the Shared Image Gallery in which the Image Definition resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// /// /// The cancellation token. @@ -502,7 +502,7 @@ public static void BeginDelete(this IGalleryImageVersionsOperations operations, } /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The operations group for this extension method. @@ -516,7 +516,7 @@ public static IPage ListByGalleryImageNext(this IGalleryIma } /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The operations group for this extension method. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperations.cs index f9021f2d57a94..02f11b8fd7aca 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperations.cs @@ -51,7 +51,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) public ComputeManagementClient Client { get; private set; } /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The name of the resource group. @@ -61,7 +61,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) /// created. /// /// - /// The name of the gallery Image Definition to be created or updated. The + /// The name of the gallery image definition to be created or updated. The /// allowed characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -82,7 +82,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) } /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The name of the resource group. @@ -92,7 +92,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) /// updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods allowed /// in the middle. The maximum length is 80 characters. /// @@ -113,7 +113,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) } /// - /// Retrieves information about a gallery Image Definition. + /// Retrieves information about a gallery image definition. /// /// /// The name of the resource group. @@ -123,7 +123,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) /// to be retrieved. /// /// - /// The name of the gallery Image Definition to be retrieved. + /// The name of the gallery image definition to be retrieved. /// /// /// Headers that will be added to request. @@ -164,7 +164,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -327,7 +327,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) /// deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// /// /// The headers that will be added to request. @@ -343,7 +343,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) } /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The name of the resource group. @@ -387,7 +387,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -538,7 +538,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) } /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The name of the resource group. @@ -548,7 +548,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) /// created. /// /// - /// The name of the gallery Image Definition to be created or updated. The + /// The name of the gallery image definition to be created or updated. The /// allowed characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -602,7 +602,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) { galleryImage.Validate(); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -798,7 +798,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) } /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The name of the resource group. @@ -808,7 +808,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) /// updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods allowed /// in the middle. The maximum length is 80 characters. /// @@ -858,7 +858,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryImage"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1028,7 +1028,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) /// deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// /// /// Headers that will be added to request. @@ -1066,7 +1066,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); } - string apiVersion = "2019-12-01"; + string apiVersion = "2020-09-30"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1201,7 +1201,7 @@ internal GalleryImagesOperations(ComputeManagementClient client) } /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperationsExtensions.cs index 0f2a873723dd1..578c096bffa62 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Compute public static partial class GalleryImagesOperationsExtensions { /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The operations group for this extension method. @@ -35,7 +35,7 @@ public static partial class GalleryImagesOperationsExtensions /// created. /// /// - /// The name of the gallery Image Definition to be created or updated. The + /// The name of the gallery image definition to be created or updated. The /// allowed characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -48,7 +48,7 @@ public static GalleryImage CreateOrUpdate(this IGalleryImagesOperations operatio } /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The operations group for this extension method. @@ -61,7 +61,7 @@ public static GalleryImage CreateOrUpdate(this IGalleryImagesOperations operatio /// created. /// /// - /// The name of the gallery Image Definition to be created or updated. The + /// The name of the gallery image definition to be created or updated. The /// allowed characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -80,7 +80,7 @@ public static GalleryImage CreateOrUpdate(this IGalleryImagesOperations operatio } /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The operations group for this extension method. @@ -93,7 +93,7 @@ public static GalleryImage CreateOrUpdate(this IGalleryImagesOperations operatio /// updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods allowed /// in the middle. The maximum length is 80 characters. /// @@ -106,7 +106,7 @@ public static GalleryImage Update(this IGalleryImagesOperations operations, stri } /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The operations group for this extension method. @@ -119,7 +119,7 @@ public static GalleryImage Update(this IGalleryImagesOperations operations, stri /// updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods allowed /// in the middle. The maximum length is 80 characters. /// @@ -138,7 +138,7 @@ public static GalleryImage Update(this IGalleryImagesOperations operations, stri } /// - /// Retrieves information about a gallery Image Definition. + /// Retrieves information about a gallery image definition. /// /// /// The operations group for this extension method. @@ -151,7 +151,7 @@ public static GalleryImage Update(this IGalleryImagesOperations operations, stri /// to be retrieved. /// /// - /// The name of the gallery Image Definition to be retrieved. + /// The name of the gallery image definition to be retrieved. /// public static GalleryImage Get(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName) { @@ -159,7 +159,7 @@ public static GalleryImage Get(this IGalleryImagesOperations operations, string } /// - /// Retrieves information about a gallery Image Definition. + /// Retrieves information about a gallery image definition. /// /// /// The operations group for this extension method. @@ -172,7 +172,7 @@ public static GalleryImage Get(this IGalleryImagesOperations operations, string /// to be retrieved. /// /// - /// The name of the gallery Image Definition to be retrieved. + /// The name of the gallery image definition to be retrieved. /// /// /// The cancellation token. @@ -199,7 +199,7 @@ public static GalleryImage Get(this IGalleryImagesOperations operations, string /// deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// public static void Delete(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName) { @@ -220,7 +220,7 @@ public static void Delete(this IGalleryImagesOperations operations, string resou /// deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// /// /// The cancellation token. @@ -231,7 +231,7 @@ public static void Delete(this IGalleryImagesOperations operations, string resou } /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The operations group for this extension method. @@ -249,7 +249,7 @@ public static IPage ListByGallery(this IGalleryImagesOperations op } /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The operations group for this extension method. @@ -273,7 +273,7 @@ public static IPage ListByGallery(this IGalleryImagesOperations op } /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The operations group for this extension method. @@ -286,7 +286,7 @@ public static IPage ListByGallery(this IGalleryImagesOperations op /// created. /// /// - /// The name of the gallery Image Definition to be created or updated. The + /// The name of the gallery image definition to be created or updated. The /// allowed characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -299,7 +299,7 @@ public static GalleryImage BeginCreateOrUpdate(this IGalleryImagesOperations ope } /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The operations group for this extension method. @@ -312,7 +312,7 @@ public static GalleryImage BeginCreateOrUpdate(this IGalleryImagesOperations ope /// created. /// /// - /// The name of the gallery Image Definition to be created or updated. The + /// The name of the gallery image definition to be created or updated. The /// allowed characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -331,7 +331,7 @@ public static GalleryImage BeginCreateOrUpdate(this IGalleryImagesOperations ope } /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The operations group for this extension method. @@ -344,7 +344,7 @@ public static GalleryImage BeginCreateOrUpdate(this IGalleryImagesOperations ope /// updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods allowed /// in the middle. The maximum length is 80 characters. /// @@ -357,7 +357,7 @@ public static GalleryImage BeginUpdate(this IGalleryImagesOperations operations, } /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The operations group for this extension method. @@ -370,7 +370,7 @@ public static GalleryImage BeginUpdate(this IGalleryImagesOperations operations, /// updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods allowed /// in the middle. The maximum length is 80 characters. /// @@ -402,7 +402,7 @@ public static GalleryImage BeginUpdate(this IGalleryImagesOperations operations, /// deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// public static void BeginDelete(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName) { @@ -423,7 +423,7 @@ public static void BeginDelete(this IGalleryImagesOperations operations, string /// deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// /// /// The cancellation token. @@ -434,7 +434,7 @@ public static void BeginDelete(this IGalleryImagesOperations operations, string } /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The operations group for this extension method. @@ -448,7 +448,7 @@ public static IPage ListByGalleryNext(this IGalleryImagesOperation } /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The operations group for this extension method. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperations.cs new file mode 100644 index 0000000000000..36d20e5f894bf --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperations.cs @@ -0,0 +1,309 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GallerySharingProfileOperations operations. + /// + internal partial class GallerySharingProfileOperations : IServiceOperations, IGallerySharingProfileOperations + { + /// + /// Initializes a new instance of the GallerySharingProfileOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GallerySharingProfileOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, sharingUpdate, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (sharingUpdate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sharingUpdate"); + } + if (sharingUpdate != null) + { + sharingUpdate.Validate(); + } + string apiVersion = "2020-09-30"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("sharingUpdate", sharingUpdate); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.Compute/galleries/{galleryName}/share").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sharingUpdate != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sharingUpdate, 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperationsExtensions.cs new file mode 100644 index 0000000000000..9ab1747dd2367 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperationsExtensions.cs @@ -0,0 +1,117 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GallerySharingProfileOperations. + /// + public static partial class GallerySharingProfileOperationsExtensions + { + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + public static SharingUpdate Update(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate) + { + return operations.UpdateAsync(resourceGroupName, galleryName, sharingUpdate).GetAwaiter().GetResult(); + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, sharingUpdate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + public static SharingUpdate BeginUpdate(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, sharingUpdate).GetAwaiter().GetResult(); + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, sharingUpdate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServiceRoleInstancesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServiceRoleInstancesOperations.cs new file mode 100644 index 0000000000000..5d97a04e5b07a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServiceRoleInstancesOperations.cs @@ -0,0 +1,362 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRoleInstancesOperations operations. + /// + public partial interface ICloudServiceRoleInstancesOperations + { + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values + /// include: 'instanceView' + /// + /// + /// 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> GetWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about the run-time state of a role instance + /// in a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// 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> GetInstanceViewWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of all role instances in a cloud service. Use + /// nextLink property in the response to get the next page of role + /// instances. Do this till nextLink is null to fetch all the role + /// instances. + /// + /// + /// + /// + /// + /// + /// The expand expression to apply to the operation. Possible values + /// include: 'instanceView' + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reboot Role Instance asynchronous operation requests a reboot + /// of a role instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reimage Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles and + /// initializes the storage resources that are used by them. If you do + /// not want to initialize storage resources, you can use Reimage Role + /// Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// 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> GetRemoteDesktopFileWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reboot Role Instance asynchronous operation requests a reboot + /// of a role instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reimage Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles and + /// initializes the storage resources that are used by them. If you do + /// not want to initialize storage resources, you can use Reimage Role + /// Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of all role instances in a cloud service. Use + /// nextLink property in the response to get the next page of role + /// instances. Do this till nextLink is null to fetch all the role + /// instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServiceRolesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServiceRolesOperations.cs new file mode 100644 index 0000000000000..16e8d96e5c5ff --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServiceRolesOperations.cs @@ -0,0 +1,102 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRolesOperations operations. + /// + public partial interface ICloudServiceRolesOperations + { + /// + /// Gets a role from a cloud service. + /// + /// + /// Name of the role. + /// + /// + /// + /// + /// + /// + /// 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> GetWithHttpMessagesAsync(string roleName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all roles in a cloud service. Use nextLink property + /// in the response to get the next page of roles. Do this till + /// nextLink is null to fetch all the roles. + /// + /// + /// + /// + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all roles in a cloud service. Use nextLink property + /// in the response to get the next page of roles. Do this till + /// nextLink is null to fetch all the roles. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServicesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServicesOperations.cs new file mode 100644 index 0000000000000..837bdd793337c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServicesOperations.cs @@ -0,0 +1,638 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesOperations operations. + /// + public partial interface ICloudServicesOperations + { + /// + /// Create or update a cloud service. Please note some properties can + /// be set only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Display information about a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// 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> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services in the subscription, regardless + /// of the associated resource group. Use nextLink property in the + /// response to get the next page of Cloud Services. Do this till + /// nextLink is null to fetch all the Cloud Services. + /// + /// + /// 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>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services under a resource group. Use + /// nextLink property in the response to get the next page of Cloud + /// Services. Do this till nextLink is null to fetch all the Cloud + /// Services. + /// + /// + /// Name of the resource group. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off the cloud service. Note that resources are still attached + /// and you are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimage asynchronous operation reinstalls the operating system on + /// instances of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Rebuild Role Instances reinstalls the operating system on instances + /// of web roles or worker roles and initializes the storage resources + /// that are used by them. If you do not want to initialize storage + /// resources, you can use Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a cloud service. Please note some properties can + /// be set only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off the cloud service. Note that resources are still attached + /// and you are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimage asynchronous operation reinstalls the operating system on + /// instances of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Rebuild Role Instances reinstalls the operating system on instances + /// of web roles or worker roles and initializes the storage resources + /// that are used by them. If you do not want to initialize storage + /// resources, you can use Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services in the subscription, regardless + /// of the associated resource group. Use nextLink property in the + /// response to get the next page of Cloud Services. Do this till + /// nextLink is null to fetch all the Cloud Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services under a resource group. Use + /// nextLink property in the response to get the next page of Cloud + /// Services. Do this till nextLink is null to fetch all the Cloud + /// Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServicesUpdateDomainOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServicesUpdateDomainOperations.cs new file mode 100644 index 0000000000000..cdac93b47a192 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICloudServicesUpdateDomainOperations.cs @@ -0,0 +1,160 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesUpdateDomainOperations operations. + /// + public partial interface ICloudServicesUpdateDomainOperations + { + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. + /// Update domains are identified with a zero-based index: the first + /// update domain has an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task WalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified update domain of a cloud service. Use nextLink + /// property in the response to get the next page of update domains. Do + /// this till nextLink is null to fetch all the update domains. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. + /// Update domains are identified with a zero-based index: the first + /// update domain has an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// 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> GetUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// 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>> ListUpdateDomainsWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. + /// Update domains are identified with a zero-based index: the first + /// update domain has an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginWalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListUpdateDomainsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs index b96ecca115229..b46d17af05348 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs @@ -221,10 +221,50 @@ public partial interface IComputeManagementClient : System.IDisposable /// IGalleryApplicationVersionsOperations GalleryApplicationVersions { get; } + /// + /// Gets the IGallerySharingProfileOperations. + /// + IGallerySharingProfileOperations GallerySharingProfile { get; } + + /// + /// Gets the ISharedGalleriesOperations. + /// + ISharedGalleriesOperations SharedGalleries { get; } + + /// + /// Gets the ISharedGalleryImagesOperations. + /// + ISharedGalleryImagesOperations SharedGalleryImages { get; } + + /// + /// Gets the ISharedGalleryImageVersionsOperations. + /// + ISharedGalleryImageVersionsOperations SharedGalleryImageVersions { get; } + /// /// Gets the IContainerServicesOperations. /// IContainerServicesOperations ContainerServices { get; } + /// + /// Gets the ICloudServiceRoleInstancesOperations. + /// + ICloudServiceRoleInstancesOperations CloudServiceRoleInstances { get; } + + /// + /// Gets the ICloudServiceRolesOperations. + /// + ICloudServiceRolesOperations CloudServiceRoles { get; } + + /// + /// Gets the ICloudServicesOperations. + /// + ICloudServicesOperations CloudServices { get; } + + /// + /// Gets the ICloudServicesUpdateDomainOperations. + /// + ICloudServicesUpdateDomainOperations CloudServicesUpdateDomain { get; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleriesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleriesOperations.cs index ca3cfebcee4cb..2e17fe75814ad 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleriesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleriesOperations.cs @@ -93,6 +93,10 @@ public partial interface IGalleriesOperations /// /// The name of the Shared Image Gallery. /// + /// + /// The select expression to apply on the operation. Possible values + /// include: 'Permissions' + /// /// /// The headers that will be added to request. /// @@ -108,7 +112,7 @@ public partial interface IGalleriesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete a Shared Image Gallery. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImageVersionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImageVersionsOperations.cs index 48a1efb60205b..60387a8991fe5 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImageVersionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImageVersionsOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Compute public partial interface IGalleryImageVersionsOperations { /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The name of the resource group. @@ -34,18 +34,18 @@ public partial interface IGalleryImageVersionsOperations /// resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// is to be created. /// /// - /// The name of the gallery Image Version to be created. Needs to + /// The name of the gallery image version to be created. Needs to /// follow semantic version name pattern: The allowed characters are /// digit and period. Digits must be within the range of a 32-bit /// integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// /// @@ -65,7 +65,7 @@ public partial interface IGalleryImageVersionsOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The name of the resource group. @@ -75,18 +75,18 @@ public partial interface IGalleryImageVersionsOperations /// resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// is to be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to + /// The name of the gallery image version to be updated. Needs to /// follow semantic version name pattern: The allowed characters are /// digit and period. Digits must be within the range of a 32-bit /// integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// /// /// The headers that will be added to request. @@ -105,7 +105,7 @@ public partial interface IGalleryImageVersionsOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Retrieves information about a gallery Image Version. + /// Retrieves information about a gallery image version. /// /// /// The name of the resource group. @@ -115,11 +115,11 @@ public partial interface IGalleryImageVersionsOperations /// resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be retrieved. + /// The name of the gallery image version to be retrieved. /// /// /// The expand expression to apply on the operation. Possible values @@ -142,7 +142,7 @@ public partial interface IGalleryImageVersionsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The name of the resource group. @@ -152,11 +152,11 @@ public partial interface IGalleryImageVersionsOperations /// resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// /// /// The headers that will be added to request. @@ -172,7 +172,7 @@ public partial interface IGalleryImageVersionsOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The name of the resource group. @@ -202,7 +202,7 @@ public partial interface IGalleryImageVersionsOperations /// Task>> ListByGalleryImageWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or update a gallery Image Version. + /// Create or update a gallery image version. /// /// /// The name of the resource group. @@ -212,18 +212,18 @@ public partial interface IGalleryImageVersionsOperations /// resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// is to be created. /// /// - /// The name of the gallery Image Version to be created. Needs to + /// The name of the gallery image version to be created. Needs to /// follow semantic version name pattern: The allowed characters are /// digit and period. Digits must be within the range of a 32-bit /// integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the create or update gallery Image Version + /// Parameters supplied to the create or update gallery image version /// operation. /// /// @@ -243,7 +243,7 @@ public partial interface IGalleryImageVersionsOperations /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Update a gallery Image Version. + /// Update a gallery image version. /// /// /// The name of the resource group. @@ -253,18 +253,18 @@ public partial interface IGalleryImageVersionsOperations /// resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// is to be updated. /// /// - /// The name of the gallery Image Version to be updated. Needs to + /// The name of the gallery image version to be updated. Needs to /// follow semantic version name pattern: The allowed characters are /// digit and period. Digits must be within the range of a 32-bit /// integer. Format: /// <MajorVersion>.<MinorVersion>.<Patch> /// /// - /// Parameters supplied to the update gallery Image Version operation. + /// Parameters supplied to the update gallery image version operation. /// /// /// The headers that will be added to request. @@ -283,7 +283,7 @@ public partial interface IGalleryImageVersionsOperations /// Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete a gallery Image Version. + /// Delete a gallery image version. /// /// /// The name of the resource group. @@ -293,11 +293,11 @@ public partial interface IGalleryImageVersionsOperations /// resides. /// /// - /// The name of the gallery Image Definition in which the Image Version + /// The name of the gallery image definition in which the Image Version /// resides. /// /// - /// The name of the gallery Image Version to be deleted. + /// The name of the gallery image version to be deleted. /// /// /// The headers that will be added to request. @@ -313,7 +313,7 @@ public partial interface IGalleryImageVersionsOperations /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List gallery Image Versions in a gallery Image Definition. + /// List gallery image versions in a gallery image definition. /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImagesOperations.cs index 523c2ffc9ffc1..bfe8aaf91f55c 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImagesOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Compute public partial interface IGalleryImagesOperations { /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The name of the resource group. @@ -34,7 +34,7 @@ public partial interface IGalleryImagesOperations /// is to be created. /// /// - /// The name of the gallery Image Definition to be created or updated. + /// The name of the gallery image definition to be created or updated. /// The allowed characters are alphabets and numbers with dots, dashes, /// and periods allowed in the middle. The maximum length is 80 /// characters. @@ -60,7 +60,7 @@ public partial interface IGalleryImagesOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The name of the resource group. @@ -70,7 +70,7 @@ public partial interface IGalleryImagesOperations /// is to be updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -94,7 +94,7 @@ public partial interface IGalleryImagesOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Retrieves information about a gallery Image Definition. + /// Retrieves information about a gallery image definition. /// /// /// The name of the resource group. @@ -104,7 +104,7 @@ public partial interface IGalleryImagesOperations /// Definitions are to be retrieved. /// /// - /// The name of the gallery Image Definition to be retrieved. + /// The name of the gallery image definition to be retrieved. /// /// /// The headers that will be added to request. @@ -133,7 +133,7 @@ public partial interface IGalleryImagesOperations /// is to be deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// /// /// The headers that will be added to request. @@ -149,7 +149,7 @@ public partial interface IGalleryImagesOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The name of the resource group. @@ -175,7 +175,7 @@ public partial interface IGalleryImagesOperations /// Task>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or update a gallery Image Definition. + /// Create or update a gallery image definition. /// /// /// The name of the resource group. @@ -185,7 +185,7 @@ public partial interface IGalleryImagesOperations /// is to be created. /// /// - /// The name of the gallery Image Definition to be created or updated. + /// The name of the gallery image definition to be created or updated. /// The allowed characters are alphabets and numbers with dots, dashes, /// and periods allowed in the middle. The maximum length is 80 /// characters. @@ -211,7 +211,7 @@ public partial interface IGalleryImagesOperations /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Update a gallery Image Definition. + /// Update a gallery image definition. /// /// /// The name of the resource group. @@ -221,7 +221,7 @@ public partial interface IGalleryImagesOperations /// is to be updated. /// /// - /// The name of the gallery Image Definition to be updated. The allowed + /// The name of the gallery image definition to be updated. The allowed /// characters are alphabets and numbers with dots, dashes, and periods /// allowed in the middle. The maximum length is 80 characters. /// @@ -255,7 +255,7 @@ public partial interface IGalleryImagesOperations /// is to be deleted. /// /// - /// The name of the gallery Image Definition to be deleted. + /// The name of the gallery image definition to be deleted. /// /// /// The headers that will be added to request. @@ -271,7 +271,7 @@ public partial interface IGalleryImagesOperations /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List gallery Image Definitions in a gallery. + /// List gallery image definitions in a gallery. /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGallerySharingProfileOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGallerySharingProfileOperations.cs new file mode 100644 index 0000000000000..851857bc297a9 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IGallerySharingProfileOperations.cs @@ -0,0 +1,83 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GallerySharingProfileOperations operations. + /// + public partial interface IGallerySharingProfileOperations + { + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleriesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleriesOperations.cs new file mode 100644 index 0000000000000..369d638e16b09 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleriesOperations.cs @@ -0,0 +1,100 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleriesOperations operations. + /// + public partial interface ISharedGalleriesOperations + { + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when + /// doing listing operations. Possible values include: 'tenant' + /// + /// + /// 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>> ListWithHttpMessagesAsync(string location, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// 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> GetWithHttpMessagesAsync(string location, string galleryUniqueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImageVersionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImageVersionsOperations.cs new file mode 100644 index 0000000000000..f885944fb8f4a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImageVersionsOperations.cs @@ -0,0 +1,118 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImageVersionsOperations operations. + /// + public partial interface ISharedGalleryImageVersionsOperations + { + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the + /// Image Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when + /// doing listing operations. Possible values include: 'tenant' + /// + /// + /// 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>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the + /// Image Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// 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> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImagesOperations.cs new file mode 100644 index 0000000000000..29684dfca5e75 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImagesOperations.cs @@ -0,0 +1,107 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImagesOperations operations. + /// + public partial interface ISharedGalleryImagesOperations + { + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when + /// doing listing operations. Possible values include: 'tenant' + /// + /// + /// 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>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the + /// Image Versions are to be listed. + /// + /// + /// 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> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs index 6aaf30ab54380..1ccfa9151680a 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs @@ -57,7 +57,7 @@ public partial interface IVirtualMachineScaleSetVMExtensionsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update the VMSS VM extension. /// @@ -92,7 +92,7 @@ public partial interface IVirtualMachineScaleSetVMExtensionsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to delete the VMSS VM extension. /// @@ -154,7 +154,7 @@ public partial interface IVirtualMachineScaleSetVMExtensionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to get all extensions of an instance in Virtual /// Machine Scaleset. @@ -186,7 +186,7 @@ public partial interface IVirtualMachineScaleSetVMExtensionsOperations /// /// Thrown when a required parameter is null /// - Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to create or update the VMSS VM extension. /// @@ -221,7 +221,7 @@ public partial interface IVirtualMachineScaleSetVMExtensionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update the VMSS VM extension. /// @@ -256,7 +256,7 @@ public partial interface IVirtualMachineScaleSetVMExtensionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to delete the VMSS VM extension. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs index cd0a8bbcdd183..a0386139bd1e7 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs @@ -142,6 +142,9 @@ public partial interface IVirtualMachinesOperations /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines. + /// /// /// The headers that will be added to request. /// @@ -154,7 +157,7 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Retrieves information about the model view or the instance view of /// a virtual machine. @@ -733,6 +736,9 @@ public partial interface IVirtualMachinesOperations /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines. + /// /// /// The headers that will be added to request. /// @@ -745,7 +751,7 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Converts virtual machine disks from blob-based to managed disks. /// Virtual machine must be stop-deallocated before invoking this diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudService.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudService.cs new file mode 100644 index 0000000000000..2332c9c2f9f2a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudService.cs @@ -0,0 +1,106 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the cloud service. + /// + public partial class CloudService : IResource + { + /// + /// Initializes a new instance of the CloudService class. + /// + public CloudService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudService class. + /// + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + public CloudService(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), CloudServiceProperties properties = default(CloudServiceProperties)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CloudServiceProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceExtensionProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceExtensionProfile.cs new file mode 100644 index 0000000000000..4458559f7cbcc --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceExtensionProfile.cs @@ -0,0 +1,56 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a cloud service extension profile. + /// + public partial class CloudServiceExtensionProfile + { + /// + /// Initializes a new instance of the CloudServiceExtensionProfile + /// class. + /// + public CloudServiceExtensionProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceExtensionProfile + /// class. + /// + /// List of extensions for the cloud + /// service. + public CloudServiceExtensionProfile(IList extensions = default(IList)) + { + Extensions = extensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of extensions for the cloud service. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceExtensionProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceExtensionProperties.cs new file mode 100644 index 0000000000000..5fbf4d36b05dc --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceExtensionProperties.cs @@ -0,0 +1,179 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Extension Properties. + /// + public partial class CloudServiceExtensionProperties + { + /// + /// Initializes a new instance of the CloudServiceExtensionProperties + /// class. + /// + public CloudServiceExtensionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceExtensionProperties + /// class. + /// + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension. + /// Specifies the version of the + /// extension. Specifies the version of the extension. If this element + /// is not specified or an asterisk (*) is used as the value, the + /// latest version of the extension is used. If the value is specified + /// with a major version number and an asterisk as the minor version + /// number (X.), the latest minor version of the specified major + /// version is selected. If a major version number and a minor version + /// number are specified (X.Y), the specific extension version is + /// selected. If a version is specified, an auto-upgrade is performed + /// on the role instance. + /// Explicitly specify whether + /// platform can automatically upgrade typeHandlerVersion to higher + /// minor versions when they become available. + /// Public settings for the extension. For JSON + /// extensions, this is the JSON settings for the extension. For XML + /// Extension (like RDP), this is the XML setting for the + /// extension. + /// Protected settings for the + /// extension which are encrypted before sent to the role + /// instance. + /// Tag to force apply the provided public + /// and protected settings. + /// Changing the tag value allows for re-running the extension without + /// changing any of the public or protected settings. + /// If forceUpdateTag is not changed, updates to public or protected + /// settings would still be applied by the handler. + /// If neither forceUpdateTag nor any of public or protected settings + /// change, extension would flow to the role instance with the same + /// sequence-number, and + /// it is up to handler implementation whether to re-run it or + /// not + /// The provisioning state, which only + /// appears in the response. + /// Optional list of roles to apply this + /// extension. If property is not specified or '*' is specified, + /// extension is applied to all roles in the cloud service. + public CloudServiceExtensionProperties(string publisher = default(string), string type = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), string settings = default(string), string protectedSettings = default(string), CloudServiceVaultAndSecretReference protectedSettingsFromKeyVault = default(CloudServiceVaultAndSecretReference), string forceUpdateTag = default(string), string provisioningState = default(string), IList rolesAppliedTo = default(IList)) + { + Publisher = publisher; + Type = type; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + Settings = settings; + ProtectedSettings = protectedSettings; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + ForceUpdateTag = forceUpdateTag; + ProvisioningState = provisioningState; + RolesAppliedTo = rolesAppliedTo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the extension. Specifies the + /// version of the extension. If this element is not specified or an + /// asterisk (*) is used as the value, the latest version of the + /// extension is used. If the value is specified with a major version + /// number and an asterisk as the minor version number (X.), the latest + /// minor version of the specified major version is selected. If a + /// major version number and a minor version number are specified + /// (X.Y), the specific extension version is selected. If a version is + /// specified, an auto-upgrade is performed on the role instance. + /// + [JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets explicitly specify whether platform can automatically + /// upgrade typeHandlerVersion to higher minor versions when they + /// become available. + /// + [JsonProperty(PropertyName = "autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets public settings for the extension. For JSON + /// extensions, this is the JSON settings for the extension. For XML + /// Extension (like RDP), this is the XML setting for the extension. + /// + [JsonProperty(PropertyName = "settings")] + public string Settings { get; set; } + + /// + /// Gets or sets protected settings for the extension which are + /// encrypted before sent to the role instance. + /// + [JsonProperty(PropertyName = "protectedSettings")] + public string ProtectedSettings { get; set; } + + /// + /// + [JsonProperty(PropertyName = "protectedSettingsFromKeyVault")] + public CloudServiceVaultAndSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Gets or sets tag to force apply the provided public and protected + /// settings. + /// Changing the tag value allows for re-running the extension without + /// changing any of the public or protected settings. + /// If forceUpdateTag is not changed, updates to public or protected + /// settings would still be applied by the handler. + /// If neither forceUpdateTag nor any of public or protected settings + /// change, extension would flow to the role instance with the same + /// sequence-number, and + /// it is up to handler implementation whether to re-run it or not + /// + [JsonProperty(PropertyName = "forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets optional list of roles to apply this extension. If + /// property is not specified or '*' is specified, extension is applied + /// to all roles in the cloud service. + /// + [JsonProperty(PropertyName = "rolesAppliedTo")] + public IList RolesAppliedTo { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceInstanceView.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceInstanceView.cs new file mode 100644 index 0000000000000..030b6de7ce0be --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceInstanceView.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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// InstanceView of CloudService as a whole + /// + public partial class CloudServiceInstanceView + { + /// + /// Initializes a new instance of the CloudServiceInstanceView class. + /// + public CloudServiceInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceInstanceView class. + /// + /// The version of the SDK that was used to + /// generate the package for the cloud service. + public CloudServiceInstanceView(InstanceViewStatusesSummary roleInstance = default(InstanceViewStatusesSummary), string sdkVersion = default(string), IList statuses = default(IList)) + { + RoleInstance = roleInstance; + SdkVersion = sdkVersion; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "roleInstance")] + public InstanceViewStatusesSummary RoleInstance { get; set; } + + /// + /// Gets the version of the SDK that was used to generate the package + /// for the cloud service. + /// + [JsonProperty(PropertyName = "sdkVersion")] + public string SdkVersion { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs new file mode 100644 index 0000000000000..e3de856fe0bfb --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs @@ -0,0 +1,61 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Network Profile for the cloud service. + /// + public partial class CloudServiceNetworkProfile + { + /// + /// Initializes a new instance of the CloudServiceNetworkProfile class. + /// + public CloudServiceNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceNetworkProfile class. + /// + /// The list of load balancer + /// configurations for the cloud service. + public CloudServiceNetworkProfile(IList loadBalancerConfigurations = default(IList), SubResource swappableCloudService = default(SubResource)) + { + LoadBalancerConfigurations = loadBalancerConfigurations; + SwappableCloudService = swappableCloudService; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of load balancer configurations for the cloud + /// service. + /// + [JsonProperty(PropertyName = "loadBalancerConfigurations")] + public IList LoadBalancerConfigurations { get; set; } + + /// + /// + [JsonProperty(PropertyName = "swappableCloudService")] + public SubResource SwappableCloudService { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceOsProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceOsProfile.cs new file mode 100644 index 0000000000000..012e60e27a47b --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceOsProfile.cs @@ -0,0 +1,55 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the OS profile for the cloud service. + /// + public partial class CloudServiceOsProfile + { + /// + /// Initializes a new instance of the CloudServiceOsProfile class. + /// + public CloudServiceOsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceOsProfile class. + /// + /// Specifies set of certificates that should be + /// installed onto the role instances. + public CloudServiceOsProfile(IList secrets = default(IList)) + { + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies set of certificates that should be installed + /// onto the role instances. + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceProperties.cs new file mode 100644 index 0000000000000..b44b5b9753a0c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceProperties.cs @@ -0,0 +1,157 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Cloud service properties + /// + public partial class CloudServiceProperties + { + /// + /// Initializes a new instance of the CloudServiceProperties class. + /// + public CloudServiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceProperties class. + /// + /// Specifies a URL that refers to the + /// location of the service package in the Blob service. The service + /// package URL can be Shared Access Signature (SAS) URI from any + /// storage account. + /// This is a write-only property and is not returned in GET + /// calls. + /// Specifies the XML service configuration + /// (.cscfg) for the cloud service. + /// Specifies a URL that refers to the + /// location of the service configuration in the Blob service. The + /// service package URL can be Shared Access Signature (SAS) URI from + /// any storage account. + /// This is a write-only property and is not returned in GET + /// calls. + /// (Optional) Indicates whether to + /// start the cloud service immediately after it is created. The + /// default value is `true`. + /// If false, the service model is still deployed, but the code is not + /// run immediately. Instead, the service is PoweredOff until you call + /// Start, at which time the service will be started. A deployed + /// service still incurs charges, even if it is poweredoff. + /// Possible values include: 'Auto', + /// 'Manual', 'Simultaneous' + /// The provisioning state, which only + /// appears in the response. + /// The unique identifier for the cloud + /// service. + public CloudServiceProperties(string packageUrl = default(string), string configuration = default(string), string configurationUrl = default(string), bool? startCloudService = default(bool?), string upgradeMode = default(string), CloudServiceRoleProfile roleProfile = default(CloudServiceRoleProfile), CloudServiceOsProfile osProfile = default(CloudServiceOsProfile), CloudServiceNetworkProfile networkProfile = default(CloudServiceNetworkProfile), CloudServiceExtensionProfile extensionProfile = default(CloudServiceExtensionProfile), string provisioningState = default(string), string uniqueId = default(string)) + { + PackageUrl = packageUrl; + Configuration = configuration; + ConfigurationUrl = configurationUrl; + StartCloudService = startCloudService; + UpgradeMode = upgradeMode; + RoleProfile = roleProfile; + OsProfile = osProfile; + NetworkProfile = networkProfile; + ExtensionProfile = extensionProfile; + ProvisioningState = provisioningState; + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies a URL that refers to the location of the + /// service package in the Blob service. The service package URL can be + /// Shared Access Signature (SAS) URI from any storage account. + /// This is a write-only property and is not returned in GET calls. + /// + [JsonProperty(PropertyName = "packageUrl")] + public string PackageUrl { get; set; } + + /// + /// Gets or sets specifies the XML service configuration (.cscfg) for + /// the cloud service. + /// + [JsonProperty(PropertyName = "configuration")] + public string Configuration { get; set; } + + /// + /// Gets or sets specifies a URL that refers to the location of the + /// service configuration in the Blob service. The service package URL + /// can be Shared Access Signature (SAS) URI from any storage account. + /// This is a write-only property and is not returned in GET calls. + /// + [JsonProperty(PropertyName = "configurationUrl")] + public string ConfigurationUrl { get; set; } + + /// + /// Gets or sets (Optional) Indicates whether to start the cloud + /// service immediately after it is created. The default value is + /// `true`. + /// If false, the service model is still deployed, but the code is not + /// run immediately. Instead, the service is PoweredOff until you call + /// Start, at which time the service will be started. A deployed + /// service still incurs charges, even if it is poweredoff. + /// + [JsonProperty(PropertyName = "startCloudService")] + public bool? StartCloudService { get; set; } + + /// + /// Gets or sets possible values include: 'Auto', 'Manual', + /// 'Simultaneous' + /// + [JsonProperty(PropertyName = "upgradeMode")] + public string UpgradeMode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "roleProfile")] + public CloudServiceRoleProfile RoleProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "osProfile")] + public CloudServiceOsProfile OsProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "networkProfile")] + public CloudServiceNetworkProfile NetworkProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extensionProfile")] + public CloudServiceExtensionProfile ExtensionProfile { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique identifier for the cloud service. + /// + [JsonProperty(PropertyName = "uniqueId")] + public string UniqueId { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRole.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRole.cs new file mode 100644 index 0000000000000..ed30d6cb8090f --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRole.cs @@ -0,0 +1,87 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a role of the cloud service. + /// + public partial class CloudServiceRole + { + /// + /// Initializes a new instance of the CloudServiceRole class. + /// + public CloudServiceRole() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRole class. + /// + /// Resource id + /// Resource name + /// Resource type + /// Resource location + public CloudServiceRole(string id = default(string), string name = default(string), string type = default(string), string location = default(string), CloudServiceRoleSku sku = default(CloudServiceRoleSku), CloudServiceRoleProperties properties = default(CloudServiceRoleProperties)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Sku = sku; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public CloudServiceRoleSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CloudServiceRoleProperties Properties { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProfile.cs new file mode 100644 index 0000000000000..6ec87974a4745 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProfile.cs @@ -0,0 +1,53 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the role profile for the cloud service. + /// + public partial class CloudServiceRoleProfile + { + /// + /// Initializes a new instance of the CloudServiceRoleProfile class. + /// + public CloudServiceRoleProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleProfile class. + /// + /// List of roles for the cloud service. + public CloudServiceRoleProfile(IList roles = default(IList)) + { + Roles = roles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of roles for the cloud service. + /// + [JsonProperty(PropertyName = "roles")] + public IList Roles { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.cs new file mode 100644 index 0000000000000..47db1e0408aa3 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.cs @@ -0,0 +1,59 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the role properties. + /// + public partial class CloudServiceRoleProfileProperties + { + /// + /// Initializes a new instance of the CloudServiceRoleProfileProperties + /// class. + /// + public CloudServiceRoleProfileProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleProfileProperties + /// class. + /// + /// Resource name. + public CloudServiceRoleProfileProperties(string name = default(string), CloudServiceRoleSku sku = default(CloudServiceRoleSku)) + { + Name = name; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public CloudServiceRoleSku Sku { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProperties.cs new file mode 100644 index 0000000000000..48d0c85661ff2 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleProperties.cs @@ -0,0 +1,50 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class CloudServiceRoleProperties + { + /// + /// Initializes a new instance of the CloudServiceRoleProperties class. + /// + public CloudServiceRoleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleProperties class. + /// + /// Specifies the ID which uniquely identifies a + /// cloud service role. + public CloudServiceRoleProperties(string uniqueId = default(string)) + { + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the ID which uniquely identifies a cloud service + /// role. + /// + [JsonProperty(PropertyName = "uniqueId")] + public string UniqueId { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleSku.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleSku.cs new file mode 100644 index 0000000000000..b0bbae8e08a56 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceRoleSku.cs @@ -0,0 +1,78 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the cloud service role sku. + /// + public partial class CloudServiceRoleSku + { + /// + /// Initializes a new instance of the CloudServiceRoleSku class. + /// + public CloudServiceRoleSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleSku class. + /// + /// The sku name. NOTE: If the new SKU is not + /// supported on the hardware the cloud service is currently on, you + /// need to delete and recreate the cloud service or move back to the + /// old sku. + /// Specifies the tier of the cloud service. + /// Possible Values are <br /><br /> **Standard** <br + /// /><br /> **Basic** + /// Specifies the number of role instances in + /// the cloud service. + public CloudServiceRoleSku(string name = default(string), string tier = default(string), long? capacity = default(long?)) + { + Name = name; + Tier = tier; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sku name. NOTE: If the new SKU is not supported on + /// the hardware the cloud service is currently on, you need to delete + /// and recreate the cloud service or move back to the old sku. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the tier of the cloud service. Possible + /// Values are &lt;br /&gt;&lt;br /&gt; **Standard** + /// &lt;br /&gt;&lt;br /&gt; **Basic** + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets or sets specifies the number of role instances in the cloud + /// service. + /// + [JsonProperty(PropertyName = "capacity")] + public long? Capacity { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceUpdate.cs new file mode 100644 index 0000000000000..6d1c6f76be04d --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceUpdate.cs @@ -0,0 +1,50 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CloudServiceUpdate + { + /// + /// Initializes a new instance of the CloudServiceUpdate class. + /// + public CloudServiceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceUpdate class. + /// + /// Resource tags + public CloudServiceUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceUpgradeMode.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceUpgradeMode.cs new file mode 100644 index 0000000000000..6d25f3f7cd7db --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceUpgradeMode.cs @@ -0,0 +1,23 @@ +// +// 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.Compute.Models +{ + + /// + /// Defines values for CloudServiceUpgradeMode. + /// + public static class CloudServiceUpgradeMode + { + public const string Auto = "Auto"; + public const string Manual = "Manual"; + public const string Simultaneous = "Simultaneous"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs new file mode 100644 index 0000000000000..13461382f05c5 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs @@ -0,0 +1,54 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class CloudServiceVaultAndSecretReference + { + /// + /// Initializes a new instance of the + /// CloudServiceVaultAndSecretReference class. + /// + public CloudServiceVaultAndSecretReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CloudServiceVaultAndSecretReference class. + /// + public CloudServiceVaultAndSecretReference(SubResource sourceVault = default(SubResource), string secretUrl = default(string)) + { + SourceVault = sourceVault; + SecretUrl = secretUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// + [JsonProperty(PropertyName = "secretUrl")] + public string SecretUrl { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultCertificate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultCertificate.cs new file mode 100644 index 0000000000000..d5643600aa3c2 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultCertificate.cs @@ -0,0 +1,56 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a single certificate reference in a Key Vault, and where the + /// certificate should reside on the role instance. + /// + public partial class CloudServiceVaultCertificate + { + /// + /// Initializes a new instance of the CloudServiceVaultCertificate + /// class. + /// + public CloudServiceVaultCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceVaultCertificate + /// class. + /// + /// This is the URL of a certificate that + /// has been uploaded to Key Vault as a secret. + public CloudServiceVaultCertificate(string certificateUrl = default(string)) + { + CertificateUrl = certificateUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is the URL of a certificate that has been + /// uploaded to Key Vault as a secret. + /// + [JsonProperty(PropertyName = "certificateUrl")] + public string CertificateUrl { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs new file mode 100644 index 0000000000000..38b9d2224c25a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a set of certificates which are all in the same Key Vault. + /// + public partial class CloudServiceVaultSecretGroup + { + /// + /// Initializes a new instance of the CloudServiceVaultSecretGroup + /// class. + /// + public CloudServiceVaultSecretGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceVaultSecretGroup + /// class. + /// + /// The relative URL of the Key Vault + /// containing all of the certificates in VaultCertificates. + /// The list of key vault references in + /// SourceVault which contain certificates. + public CloudServiceVaultSecretGroup(SubResource sourceVault = default(SubResource), IList vaultCertificates = default(IList)) + { + SourceVault = sourceVault; + VaultCertificates = vaultCertificates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the relative URL of the Key Vault containing all of + /// the certificates in VaultCertificates. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Gets or sets the list of key vault references in SourceVault which + /// contain certificates. + /// + [JsonProperty(PropertyName = "vaultCertificates")] + public IList VaultCertificates { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Extension.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Extension.cs new file mode 100644 index 0000000000000..66db804aec3fc --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Extension.cs @@ -0,0 +1,57 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a cloud service Extension. + /// + public partial class Extension + { + /// + /// Initializes a new instance of the Extension class. + /// + public Extension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Extension class. + /// + /// The name of the extension. + public Extension(string name = default(string), CloudServiceExtensionProperties properties = default(CloudServiceExtensionProperties)) + { + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CloudServiceExtensionProperties Properties { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Gallery.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Gallery.cs index 3164fc5d82596..df6b6a84056c6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Gallery.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Gallery.cs @@ -44,12 +44,13 @@ public Gallery() /// Gallery resource. This property is updatable. /// The current state of the /// gallery. - public Gallery(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), GalleryIdentifier identifier = default(GalleryIdentifier), string provisioningState = default(string)) + public Gallery(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), GalleryIdentifier identifier = default(GalleryIdentifier), string provisioningState = default(string), SharingProfile sharingProfile = default(SharingProfile)) : base(location, id, name, type, tags) { Description = description; Identifier = identifier; ProvisioningState = provisioningState; + SharingProfile = sharingProfile; CustomInit(); } @@ -81,6 +82,11 @@ public Gallery() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } + /// + /// + [JsonProperty(PropertyName = "properties.sharingProfile")] + public SharingProfile SharingProfile { get; set; } + /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs index 3705c404cf17e..90a4c08c1c332 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// The publishing profile of a gallery Image Version. + /// The publishing profile of a gallery image version. /// public partial class GalleryApplicationVersionPublishingProfile : GalleryArtifactPublishingProfileBase { @@ -45,24 +45,21 @@ public GalleryApplicationVersionPublishingProfile() /// deployed from the latest version of the Image Definition won't use /// this Image Version. /// The timestamp for when the gallery - /// Image Version is published. + /// image version is published. /// The end of life date of the gallery - /// Image Version. This property can be used for decommissioning + /// image version. This property can be used for decommissioning /// purposes. This property is updatable. /// Specifies the storage account type /// to be used to store the image. This property is not updatable. /// Possible values include: 'Standard_LRS', 'Standard_ZRS', /// 'Premium_LRS' - /// Optional. May be used to help process - /// this file. The type of file contained in the source, e.g. zip, - /// json, etc. /// Optional. Whether or not this /// application reports health. - public GalleryApplicationVersionPublishingProfile(UserArtifactSource source, IList targetRegions = default(IList), int? replicaCount = default(int?), bool? excludeFromLatest = default(bool?), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?), string storageAccountType = default(string), string contentType = default(string), bool? enableHealthCheck = default(bool?)) + public GalleryApplicationVersionPublishingProfile(UserArtifactSource source, IList targetRegions = default(IList), int? replicaCount = default(int?), bool? excludeFromLatest = default(bool?), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?), string storageAccountType = default(string), UserArtifactManage manageActions = default(UserArtifactManage), bool? enableHealthCheck = default(bool?)) : base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType) { Source = source; - ContentType = contentType; + ManageActions = manageActions; EnableHealthCheck = enableHealthCheck; CustomInit(); } @@ -78,11 +75,9 @@ public GalleryApplicationVersionPublishingProfile() public UserArtifactSource Source { get; set; } /// - /// Gets or sets optional. May be used to help process this file. The - /// type of file contained in the source, e.g. zip, json, etc. /// - [JsonProperty(PropertyName = "contentType")] - public string ContentType { get; set; } + [JsonProperty(PropertyName = "manageActions")] + public UserArtifactManage ManageActions { get; set; } /// /// Gets or sets optional. Whether or not this application reports @@ -107,6 +102,10 @@ public virtual void Validate() { Source.Validate(); } + if (ManageActions != null) + { + ManageActions.Validate(); + } } } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs index 1b6b478f2b6b2..8f21c927feef7 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs @@ -44,9 +44,9 @@ public GalleryArtifactPublishingProfileBase() /// deployed from the latest version of the Image Definition won't use /// this Image Version. /// The timestamp for when the gallery - /// Image Version is published. + /// image version is published. /// The end of life date of the gallery - /// Image Version. This property can be used for decommissioning + /// image version. This property can be used for decommissioning /// purposes. This property is updatable. /// Specifies the storage account type /// to be used to store the image. This property is not updatable. @@ -93,13 +93,13 @@ public GalleryArtifactPublishingProfileBase() public bool? ExcludeFromLatest { get; set; } /// - /// Gets the timestamp for when the gallery Image Version is published. + /// Gets the timestamp for when the gallery image version is published. /// [JsonProperty(PropertyName = "publishedDate")] public System.DateTime? PublishedDate { get; private set; } /// - /// Gets or sets the end of life date of the gallery Image Version. + /// Gets or sets the end of life date of the gallery image version. /// This property can be used for decommissioning purposes. This /// property is updatable. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs index 7617dbe215562..ebe95fdfc09b1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs @@ -32,10 +32,14 @@ public GalleryArtifactVersionSource() /// class. /// /// The id of the gallery artifact version source. Can - /// specify a disk uri, snapshot uri, or user image. - public GalleryArtifactVersionSource(string id = default(string)) + /// specify a disk uri, snapshot uri, user image or storage account + /// resource. + /// The uri of the gallery artifact version source. + /// Currently used to specify vhd/blob source. + public GalleryArtifactVersionSource(string id = default(string), string uri = default(string)) { Id = id; + Uri = uri; CustomInit(); } @@ -46,10 +50,18 @@ public GalleryArtifactVersionSource() /// /// Gets or sets the id of the gallery artifact version source. Can - /// specify a disk uri, snapshot uri, or user image. + /// specify a disk uri, snapshot uri, user image or storage account + /// resource. /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } + /// + /// Gets or sets the uri of the gallery artifact version source. + /// Currently used to specify vhd/blob source. + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImage.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImage.cs index 276cb3aeaae56..62dbb59864dfc 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImage.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImage.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// Specifies information about the gallery Image Definition that you want + /// Specifies information about the gallery image definition that you want /// to create or update. /// [Rest.Serialization.JsonTransformation] @@ -49,22 +49,23 @@ public GalleryImage() /// Resource name /// Resource type /// Resource tags - /// The description of this gallery Image - /// Definition resource. This property is updatable. - /// The Eula agreement for the gallery Image - /// Definition. + /// The description of this gallery image + /// definition resource. This property is updatable. + /// The Eula agreement for the gallery image + /// definition. /// The privacy statement /// uri. /// The release note uri. /// The hypervisor generation of the /// Virtual Machine. Applicable to OS disks only. Possible values /// include: 'V1', 'V2' + /// A list of gallery image features. /// The end of life date of the gallery - /// Image Definition. This property can be used for decommissioning + /// image definition. This property can be used for decommissioning /// purposes. This property is updatable. /// The current state of the gallery - /// Image Definition. - public GalleryImage(string location, OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), string hyperVGeneration = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string provisioningState = default(string)) + /// image definition. + public GalleryImage(string location, OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), string hyperVGeneration = default(string), IList features = default(IList), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string provisioningState = default(string)) : base(location, id, name, type, tags) { Description = description; @@ -74,6 +75,7 @@ public GalleryImage() OsType = osType; OsState = osState; HyperVGeneration = hyperVGeneration; + Features = features; EndOfLifeDate = endOfLifeDate; Identifier = identifier; Recommended = recommended; @@ -89,14 +91,14 @@ public GalleryImage() partial void CustomInit(); /// - /// Gets or sets the description of this gallery Image Definition + /// Gets or sets the description of this gallery image definition /// resource. This property is updatable. /// [JsonProperty(PropertyName = "properties.description")] public string Description { get; set; } /// - /// Gets or sets the Eula agreement for the gallery Image Definition. + /// Gets or sets the Eula agreement for the gallery image definition. /// [JsonProperty(PropertyName = "properties.eula")] public string Eula { get; set; } @@ -141,7 +143,13 @@ public GalleryImage() public string HyperVGeneration { get; set; } /// - /// Gets or sets the end of life date of the gallery Image Definition. + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. /// This property can be used for decommissioning purposes. This /// property is updatable. /// @@ -169,7 +177,7 @@ public GalleryImage() public ImagePurchasePlan PurchasePlan { get; set; } /// - /// Gets the current state of the gallery Image Definition. + /// Gets the current state of the gallery image definition. /// /// /// The provisioning state, which only appears in the response. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageFeature.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageFeature.cs new file mode 100644 index 0000000000000..2aa52c29b60bc --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageFeature.cs @@ -0,0 +1,59 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A feature for gallery image. + /// + public partial class GalleryImageFeature + { + /// + /// Initializes a new instance of the GalleryImageFeature class. + /// + public GalleryImageFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageFeature class. + /// + /// The name of the gallery image feature. + /// The value of the gallery image feature. + public GalleryImageFeature(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the gallery image feature. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the gallery image feature. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageIdentifier.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageIdentifier.cs index b18ce093894f1..5f3835b6879fa 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageIdentifier.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageIdentifier.cs @@ -15,7 +15,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// This is the gallery Image Definition identifier. + /// This is the gallery image definition identifier. /// public partial class GalleryImageIdentifier { @@ -30,11 +30,11 @@ public GalleryImageIdentifier() /// /// Initializes a new instance of the GalleryImageIdentifier class. /// - /// The name of the gallery Image Definition + /// The name of the gallery image definition /// publisher. - /// The name of the gallery Image Definition + /// The name of the gallery image definition /// offer. - /// The name of the gallery Image Definition + /// The name of the gallery image definition /// SKU. public GalleryImageIdentifier(string publisher, string offer, string sku) { @@ -50,19 +50,19 @@ public GalleryImageIdentifier(string publisher, string offer, string sku) partial void CustomInit(); /// - /// Gets or sets the name of the gallery Image Definition publisher. + /// Gets or sets the name of the gallery image definition publisher. /// [JsonProperty(PropertyName = "publisher")] public string Publisher { get; set; } /// - /// Gets or sets the name of the gallery Image Definition offer. + /// Gets or sets the name of the gallery image definition offer. /// [JsonProperty(PropertyName = "offer")] public string Offer { get; set; } /// - /// Gets or sets the name of the gallery Image Definition SKU. + /// Gets or sets the name of the gallery image definition SKU. /// [JsonProperty(PropertyName = "sku")] public string Sku { get; set; } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageUpdate.cs index 4ac822d3c550b..de806c8b415bb 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageUpdate.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// Specifies information about the gallery Image Definition that you want + /// Specifies information about the gallery image definition that you want /// to update. /// [Rest.Serialization.JsonTransformation] @@ -48,22 +48,23 @@ public GalleryImageUpdate() /// Resource name /// Resource type /// Resource tags - /// The description of this gallery Image - /// Definition resource. This property is updatable. - /// The Eula agreement for the gallery Image - /// Definition. + /// The description of this gallery image + /// definition resource. This property is updatable. + /// The Eula agreement for the gallery image + /// definition. /// The privacy statement /// uri. /// The release note uri. /// The hypervisor generation of the /// Virtual Machine. Applicable to OS disks only. Possible values /// include: 'V1', 'V2' + /// A list of gallery image features. /// The end of life date of the gallery - /// Image Definition. This property can be used for decommissioning + /// image definition. This property can be used for decommissioning /// purposes. This property is updatable. /// The current state of the gallery - /// Image Definition. - public GalleryImageUpdate(OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), string hyperVGeneration = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string provisioningState = default(string)) + /// image definition. + public GalleryImageUpdate(OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), string hyperVGeneration = default(string), IList features = default(IList), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string provisioningState = default(string)) : base(id, name, type, tags) { Description = description; @@ -73,6 +74,7 @@ public GalleryImageUpdate() OsType = osType; OsState = osState; HyperVGeneration = hyperVGeneration; + Features = features; EndOfLifeDate = endOfLifeDate; Identifier = identifier; Recommended = recommended; @@ -88,14 +90,14 @@ public GalleryImageUpdate() partial void CustomInit(); /// - /// Gets or sets the description of this gallery Image Definition + /// Gets or sets the description of this gallery image definition /// resource. This property is updatable. /// [JsonProperty(PropertyName = "properties.description")] public string Description { get; set; } /// - /// Gets or sets the Eula agreement for the gallery Image Definition. + /// Gets or sets the Eula agreement for the gallery image definition. /// [JsonProperty(PropertyName = "properties.eula")] public string Eula { get; set; } @@ -140,7 +142,13 @@ public GalleryImageUpdate() public string HyperVGeneration { get; set; } /// - /// Gets or sets the end of life date of the gallery Image Definition. + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. /// This property can be used for decommissioning purposes. This /// property is updatable. /// @@ -168,7 +176,7 @@ public GalleryImageUpdate() public ImagePurchasePlan PurchasePlan { get; set; } /// - /// Gets the current state of the gallery Image Definition. + /// Gets the current state of the gallery image definition. /// /// /// The provisioning state, which only appears in the response. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersion.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersion.cs index a7ad1dea5fab9..707a553ae2c51 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersion.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersion.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// Specifies information about the gallery Image Version that you want to + /// Specifies information about the gallery image version that you want to /// create or update. /// [Rest.Serialization.JsonTransformation] @@ -41,7 +41,7 @@ public GalleryImageVersion() /// Resource type /// Resource tags /// The current state of the gallery - /// Image Version. + /// image version. public GalleryImageVersion(string location, GalleryImageVersionStorageProfile storageProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), GalleryImageVersionPublishingProfile publishingProfile = default(GalleryImageVersionPublishingProfile), string provisioningState = default(string), ReplicationStatus replicationStatus = default(ReplicationStatus)) : base(location, id, name, type, tags) { @@ -63,7 +63,7 @@ public GalleryImageVersion() public GalleryImageVersionPublishingProfile PublishingProfile { get; set; } /// - /// Gets the current state of the gallery Image Version. + /// Gets the current state of the gallery image version. /// /// /// The provisioning state, which only appears in the response. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs index 6881266310aa4..d047e097275a6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs @@ -15,7 +15,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// The publishing profile of a gallery Image Version. + /// The publishing profile of a gallery image Version. /// public partial class GalleryImageVersionPublishingProfile : GalleryArtifactPublishingProfileBase { @@ -43,9 +43,9 @@ public GalleryImageVersionPublishingProfile() /// deployed from the latest version of the Image Definition won't use /// this Image Version. /// The timestamp for when the gallery - /// Image Version is published. + /// image version is published. /// The end of life date of the gallery - /// Image Version. This property can be used for decommissioning + /// image version. This property can be used for decommissioning /// purposes. This property is updatable. /// Specifies the storage account type /// to be used to store the image. This property is not updatable. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionUpdate.cs index 95a7c06e84e8c..174e5218e0fe5 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionUpdate.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// Specifies information about the gallery Image Version that you want to + /// Specifies information about the gallery image version that you want to /// update. /// [Rest.Serialization.JsonTransformation] @@ -40,7 +40,7 @@ public GalleryImageVersionUpdate() /// Resource type /// Resource tags /// The current state of the gallery - /// Image Version. + /// image version. public GalleryImageVersionUpdate(GalleryImageVersionStorageProfile storageProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), GalleryImageVersionPublishingProfile publishingProfile = default(GalleryImageVersionPublishingProfile), string provisioningState = default(string), ReplicationStatus replicationStatus = default(ReplicationStatus)) : base(id, name, type, tags) { @@ -62,7 +62,7 @@ public GalleryImageVersionUpdate() public GalleryImageVersionPublishingProfile PublishingProfile { get; set; } /// - /// Gets the current state of the gallery Image Version. + /// Gets the current state of the gallery image version. /// /// /// The provisioning state, which only appears in the response. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GallerySharingPermissionTypes.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GallerySharingPermissionTypes.cs new file mode 100644 index 0000000000000..22f0125b9557b --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GallerySharingPermissionTypes.cs @@ -0,0 +1,22 @@ +// +// 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.Compute.Models +{ + + /// + /// Defines values for GallerySharingPermissionTypes. + /// + public static class GallerySharingPermissionTypes + { + public const string Private = "Private"; + public const string Groups = "Groups"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryUpdate.cs index e46c769da8b32..23ea5f90f3c5e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryUpdate.cs @@ -43,12 +43,13 @@ public GalleryUpdate() /// Gallery resource. This property is updatable. /// The current state of the /// gallery. - public GalleryUpdate(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), GalleryIdentifier identifier = default(GalleryIdentifier), string provisioningState = default(string)) + public GalleryUpdate(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), GalleryIdentifier identifier = default(GalleryIdentifier), string provisioningState = default(string), SharingProfile sharingProfile = default(SharingProfile)) : base(id, name, type, tags) { Description = description; Identifier = identifier; ProvisioningState = provisioningState; + SharingProfile = sharingProfile; CustomInit(); } @@ -80,5 +81,10 @@ public GalleryUpdate() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } + /// + /// + [JsonProperty(PropertyName = "properties.sharingProfile")] + public SharingProfile SharingProfile { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImagePurchasePlan.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImagePurchasePlan.cs index 8c15c2873d2e1..491af12db0e46 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImagePurchasePlan.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImagePurchasePlan.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// Describes the gallery Image Definition purchase plan. This is used by + /// Describes the gallery image definition purchase plan. This is used by /// marketplace images. /// public partial class ImagePurchasePlan diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceSku.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceSku.cs new file mode 100644 index 0000000000000..cc6d5e72fe8c6 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceSku.cs @@ -0,0 +1,57 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class InstanceSku + { + /// + /// Initializes a new instance of the InstanceSku class. + /// + public InstanceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstanceSku class. + /// + /// The sku name. + /// The tier of the cloud service role + /// instance. + public InstanceSku(string name = default(string), string tier = default(string)) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the sku name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the tier of the cloud service role instance. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewStatusesSummary.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewStatusesSummary.cs new file mode 100644 index 0000000000000..37cee73429f98 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewStatusesSummary.cs @@ -0,0 +1,53 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Instance view statuses. + /// + public partial class InstanceViewStatusesSummary + { + /// + /// Initializes a new instance of the InstanceViewStatusesSummary + /// class. + /// + public InstanceViewStatusesSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstanceViewStatusesSummary + /// class. + /// + public InstanceViewStatusesSummary(IList statusesSummary = default(IList)) + { + StatusesSummary = statusesSummary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "statusesSummary")] + public IList StatusesSummary { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerConfiguration.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerConfiguration.cs new file mode 100644 index 0000000000000..1965c9fc649f0 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerConfiguration.cs @@ -0,0 +1,57 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the load balancer configuration. + /// + public partial class LoadBalancerConfiguration + { + /// + /// Initializes a new instance of the LoadBalancerConfiguration class. + /// + public LoadBalancerConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoadBalancerConfiguration class. + /// + /// Resource Name + public LoadBalancerConfiguration(string name = default(string), LoadBalancerConfigurationProperties properties = default(LoadBalancerConfigurationProperties)) + { + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public LoadBalancerConfigurationProperties Properties { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerConfigurationProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerConfigurationProperties.cs new file mode 100644 index 0000000000000..4c91346aecc3a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerConfigurationProperties.cs @@ -0,0 +1,52 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class LoadBalancerConfigurationProperties + { + /// + /// Initializes a new instance of the + /// LoadBalancerConfigurationProperties class. + /// + public LoadBalancerConfigurationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LoadBalancerConfigurationProperties class. + /// + /// List of IP + public LoadBalancerConfigurationProperties(IList frontendIPConfigurations = default(IList)) + { + FrontendIPConfigurations = frontendIPConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of IP + /// + [JsonProperty(PropertyName = "frontendIPConfigurations")] + public IList FrontendIPConfigurations { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.cs new file mode 100644 index 0000000000000..ff6622e4be2a5 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.cs @@ -0,0 +1,54 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class LoadBalancerFrontendIPConfiguration + { + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIPConfiguration class. + /// + public LoadBalancerFrontendIPConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIPConfiguration class. + /// + public LoadBalancerFrontendIPConfiguration(string name = default(string), LoadBalancerFrontendIPConfigurationProperties properties = default(LoadBalancerFrontendIPConfigurationProperties)) + { + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public LoadBalancerFrontendIPConfigurationProperties Properties { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.cs new file mode 100644 index 0000000000000..7187963be8cda --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a cloud service IP Configuration + /// + public partial class LoadBalancerFrontendIPConfigurationProperties + { + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIPConfigurationProperties class. + /// + public LoadBalancerFrontendIPConfigurationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIPConfigurationProperties class. + /// + /// The private IP address referenced by + /// the cloud service. + public LoadBalancerFrontendIPConfigurationProperties(SubResource publicIPAddress = default(SubResource), SubResource subnet = default(SubResource), string privateIPAddress = default(string)) + { + PublicIPAddress = publicIPAddress; + Subnet = subnet; + PrivateIPAddress = privateIPAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "publicIPAddress")] + public SubResource PublicIPAddress { get; set; } + + /// + /// + [JsonProperty(PropertyName = "subnet")] + public SubResource Subnet { get; set; } + + /// + /// Gets or sets the private IP address referenced by the cloud + /// service. + /// + [JsonProperty(PropertyName = "privateIPAddress")] + public string PrivateIPAddress { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsInputBase.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsInputBase.cs index 293dbae4c0646..925a407294dfe 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsInputBase.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsInputBase.cs @@ -40,7 +40,11 @@ public LogAnalyticsInputBase() /// Name. /// Group query result by Resource /// Name. - public LogAnalyticsInputBase(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?)) + /// Group query result by + /// Client Application ID. + /// Group query result by User + /// Agent. + public LogAnalyticsInputBase(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?), bool? groupByClientApplicationId = default(bool?), bool? groupByUserAgent = default(bool?)) { BlobContainerSasUri = blobContainerSasUri; FromTime = fromTime; @@ -48,6 +52,8 @@ public LogAnalyticsInputBase() GroupByThrottlePolicy = groupByThrottlePolicy; GroupByOperationName = groupByOperationName; GroupByResourceName = groupByResourceName; + GroupByClientApplicationId = groupByClientApplicationId; + GroupByUserAgent = groupByUserAgent; CustomInit(); } @@ -93,6 +99,18 @@ public LogAnalyticsInputBase() [JsonProperty(PropertyName = "groupByResourceName")] public bool? GroupByResourceName { get; set; } + /// + /// Gets or sets group query result by Client Application ID. + /// + [JsonProperty(PropertyName = "groupByClientApplicationId")] + public bool? GroupByClientApplicationId { get; set; } + + /// + /// Gets or sets group query result by User Agent. + /// + [JsonProperty(PropertyName = "groupByUserAgent")] + public bool? GroupByUserAgent { get; set; } + /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirResource.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirResource.cs new file mode 100644 index 0000000000000..7a1e494e0651c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirResource.cs @@ -0,0 +1,59 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class PirResource + { + /// + /// Initializes a new instance of the PirResource class. + /// + public PirResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PirResource class. + /// + /// Resource name + /// Resource location + public PirResource(string name = default(string), string location = default(string)) + { + Name = name; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirSharedGalleryResource.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirSharedGalleryResource.cs new file mode 100644 index 0000000000000..1ee9785ad48c9 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirSharedGalleryResource.cs @@ -0,0 +1,58 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base information about the shared gallery resource in pir. + /// + [Rest.Serialization.JsonTransformation] + public partial class PirSharedGalleryResource : PirResource + { + /// + /// Initializes a new instance of the PirSharedGalleryResource class. + /// + public PirSharedGalleryResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PirSharedGalleryResource class. + /// + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + public PirSharedGalleryResource(string name = default(string), string location = default(string), string uniqueId = default(string)) + : base(name, location) + { + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the unique id of this shared gallery. + /// + [JsonProperty(PropertyName = "identifier.uniqueId")] + public string UniqueId { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RegionalReplicationStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RegionalReplicationStatus.cs index 1723a9663fe32..a40af552a406e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RegionalReplicationStatus.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RegionalReplicationStatus.cs @@ -29,7 +29,7 @@ public RegionalReplicationStatus() /// /// Initializes a new instance of the RegionalReplicationStatus class. /// - /// The region to which the gallery Image Version + /// The region to which the gallery image version /// is being replicated to. /// This is the regional replication state. /// Possible values include: 'Unknown', 'Replicating', 'Completed', @@ -53,7 +53,7 @@ public RegionalReplicationStatus() partial void CustomInit(); /// - /// Gets the region to which the gallery Image Version is being + /// Gets the region to which the gallery image version is being /// replicated to. /// [JsonProperty(PropertyName = "region")] diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatus.cs index 17e4a4ad55a5d..5263ab5776131 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatus.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatus.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.Compute.Models using System.Linq; /// - /// This is the replication status of the gallery Image Version. + /// This is the replication status of the gallery image version. /// public partial class ReplicationStatus { diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RequestRateByIntervalInput.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RequestRateByIntervalInput.cs index 994e73e9bd337..a8fe7e5d4b1c4 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RequestRateByIntervalInput.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RequestRateByIntervalInput.cs @@ -42,8 +42,12 @@ public RequestRateByIntervalInput() /// Name. /// Group query result by Resource /// Name. - public RequestRateByIntervalInput(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, IntervalInMins intervalLength, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?)) - : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName) + /// Group query result by + /// Client Application ID. + /// Group query result by User + /// Agent. + public RequestRateByIntervalInput(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, IntervalInMins intervalLength, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?), bool? groupByClientApplicationId = default(bool?), bool? groupByUserAgent = default(bool?)) + : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent) { IntervalLength = intervalLength; CustomInit(); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceInstanceViewStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceInstanceViewStatus.cs new file mode 100644 index 0000000000000..fd6a5d166a6af --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceInstanceViewStatus.cs @@ -0,0 +1,88 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Instance view status. + /// + public partial class ResourceInstanceViewStatus + { + /// + /// Initializes a new instance of the ResourceInstanceViewStatus class. + /// + public ResourceInstanceViewStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceInstanceViewStatus class. + /// + /// The status code. + /// The short localizable label for the + /// status. + /// The detailed status message, including for + /// alerts and error messages. + /// The time of the status. + /// The level code. Possible values include: + /// 'Info', 'Warning', 'Error' + public ResourceInstanceViewStatus(string code = default(string), string displayStatus = default(string), string message = default(string), System.DateTime? time = default(System.DateTime?), StatusLevelTypes? level = default(StatusLevelTypes?)) + { + Code = code; + DisplayStatus = displayStatus; + Message = message; + Time = time; + Level = level; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the status code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the short localizable label for the status. + /// + [JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus { get; private set; } + + /// + /// Gets the detailed status message, including for alerts and error + /// messages. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the time of the status. + /// + [JsonProperty(PropertyName = "time")] + public System.DateTime? Time { get; private set; } + + /// + /// Gets or sets the level code. Possible values include: 'Info', + /// 'Warning', 'Error' + /// + [JsonProperty(PropertyName = "level")] + public StatusLevelTypes? Level { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstance.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstance.cs new file mode 100644 index 0000000000000..1dabc78b11da7 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstance.cs @@ -0,0 +1,94 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class RoleInstance + { + /// + /// Initializes a new instance of the RoleInstance class. + /// + public RoleInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstance class. + /// + /// Resource Id + /// Resource Name. + /// Resource Type. + /// Resource Location. + /// Resource tags. + public RoleInstance(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), InstanceSku sku = default(InstanceSku), RoleInstanceProperties properties = default(RoleInstanceProperties)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Sku = sku; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource Name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource Type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource Location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public InstanceSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public RoleInstanceProperties Properties { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceInstanceView.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceInstanceView.cs new file mode 100644 index 0000000000000..5897af48e493b --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceInstanceView.cs @@ -0,0 +1,83 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of the role instance. + /// + public partial class RoleInstanceInstanceView + { + /// + /// Initializes a new instance of the RoleInstanceInstanceView class. + /// + public RoleInstanceInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstanceInstanceView class. + /// + /// The Update Domain. + /// The Fault Domain. + /// Specifies a unique identifier generated + /// internally for the cloud service associated with this role + /// instance. <br /><br /> NOTE: If you are using Azure + /// Diagnostics extension, this property can be used as 'DeploymentId' + /// for querying details. + public RoleInstanceInstanceView(int? platformUpdateDomain = default(int?), int? platformFaultDomain = default(int?), string privateId = default(string), IList statuses = default(IList)) + { + PlatformUpdateDomain = platformUpdateDomain; + PlatformFaultDomain = platformFaultDomain; + PrivateId = privateId; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Update Domain. + /// + [JsonProperty(PropertyName = "platformUpdateDomain")] + public int? PlatformUpdateDomain { get; private set; } + + /// + /// Gets the Fault Domain. + /// + [JsonProperty(PropertyName = "platformFaultDomain")] + public int? PlatformFaultDomain { get; private set; } + + /// + /// Gets specifies a unique identifier generated internally for the + /// cloud service associated with this role instance. &lt;br + /// /&gt;&lt;br /&gt; NOTE: If you are using Azure + /// Diagnostics extension, this property can be used as 'DeploymentId' + /// for querying details. + /// + [JsonProperty(PropertyName = "privateId")] + public string PrivateId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs new file mode 100644 index 0000000000000..4a74b02f36107 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs @@ -0,0 +1,56 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the network profile for the role instance. + /// + public partial class RoleInstanceNetworkProfile + { + /// + /// Initializes a new instance of the RoleInstanceNetworkProfile class. + /// + public RoleInstanceNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstanceNetworkProfile class. + /// + /// Specifies the list of resource Ids + /// for the network interfaces associated with the role + /// instance. + public RoleInstanceNetworkProfile(IList networkInterfaces = default(IList)) + { + NetworkInterfaces = networkInterfaces; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the list of resource Ids for the network interfaces + /// associated with the role instance. + /// + [JsonProperty(PropertyName = "networkInterfaces")] + public IList NetworkInterfaces { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceProperties.cs new file mode 100644 index 0000000000000..fb7bd0ef45265 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstanceProperties.cs @@ -0,0 +1,52 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class RoleInstanceProperties + { + /// + /// Initializes a new instance of the RoleInstanceProperties class. + /// + public RoleInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstanceProperties class. + /// + public RoleInstanceProperties(RoleInstanceNetworkProfile networkProfile = default(RoleInstanceNetworkProfile), RoleInstanceInstanceView instanceView = default(RoleInstanceInstanceView)) + { + NetworkProfile = networkProfile; + InstanceView = instanceView; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "networkProfile")] + public RoleInstanceNetworkProfile NetworkProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "instanceView")] + public RoleInstanceInstanceView InstanceView { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstances.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstances.cs new file mode 100644 index 0000000000000..ca428016fc697 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RoleInstances.cs @@ -0,0 +1,70 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies a list of role instances from the cloud service. + /// + public partial class RoleInstances + { + /// + /// Initializes a new instance of the RoleInstances class. + /// + public RoleInstances() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstances class. + /// + /// List of cloud service role + /// instance names. Value of '*' will signify all role instances of the + /// cloud service. + public RoleInstances(IList roleInstancesProperty) + { + RoleInstancesProperty = roleInstancesProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of cloud service role instance names. Value of + /// '*' will signify all role instances of the cloud service. + /// + [JsonProperty(PropertyName = "roleInstances")] + public IList RoleInstancesProperty { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RoleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RoleInstancesProperty"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SelectPermissions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SelectPermissions.cs new file mode 100644 index 0000000000000..dcd358cd68e36 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SelectPermissions.cs @@ -0,0 +1,21 @@ +// +// 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.Compute.Models +{ + + /// + /// Defines values for SelectPermissions. + /// + public static class SelectPermissions + { + public const string Permissions = "Permissions"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGallery.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGallery.cs new file mode 100644 index 0000000000000..aef86d0b185c6 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGallery.cs @@ -0,0 +1,48 @@ +// +// 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.Compute.Models +{ + using System.Linq; + + /// + /// Specifies information about the Shared Gallery that you want to create + /// or update. + /// + public partial class SharedGallery : PirSharedGalleryResource + { + /// + /// Initializes a new instance of the SharedGallery class. + /// + public SharedGallery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGallery class. + /// + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + public SharedGallery(string name = default(string), string location = default(string), string uniqueId = default(string)) + : base(name, location, uniqueId) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImage.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImage.cs new file mode 100644 index 0000000000000..e64cdf38245e3 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImage.cs @@ -0,0 +1,157 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image definition that you want + /// to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class SharedGalleryImage : PirSharedGalleryResource + { + /// + /// Initializes a new instance of the SharedGalleryImage class. + /// + public SharedGalleryImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGalleryImage class. + /// + /// This property allows you to specify the type + /// of the OS that is included in the disk when creating a VM from a + /// managed image. <br><br> Possible values are: + /// <br><br> **Windows** <br><br> **Linux**. + /// Possible values include: 'Windows', 'Linux' + /// This property allows the user to specify + /// whether the virtual machines created under this image are + /// 'Generalized' or 'Specialized'. Possible values include: + /// 'Generalized', 'Specialized' + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + /// The end of life date of the gallery + /// image definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// A list of gallery image features. + public SharedGalleryImage(OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string name = default(string), string location = default(string), string uniqueId = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), string hyperVGeneration = default(string), IList features = default(IList), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan)) + : base(name, location, uniqueId) + { + OsType = osType; + OsState = osState; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + HyperVGeneration = hyperVGeneration; + Features = features; + PurchasePlan = purchasePlan; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk when creating a VM from a managed + /// image. &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets this property allows the user to specify whether the + /// virtual machines created under this image are 'Generalized' or + /// 'Specialized'. Possible values include: 'Generalized', + /// 'Specialized' + /// + [JsonProperty(PropertyName = "properties.osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryImageIdentifier Identifier { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommended")] + public RecommendedMachineConfiguration Recommended { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public Disallowed Disallowed { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Identifier"); + } + if (Identifier != null) + { + Identifier.Validate(); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImageVersion.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImageVersion.cs new file mode 100644 index 0000000000000..b51fcbd0b480e --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImageVersion.cs @@ -0,0 +1,76 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies information about the gallery image version that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class SharedGalleryImageVersion : PirSharedGalleryResource + { + /// + /// Initializes a new instance of the SharedGalleryImageVersion class. + /// + public SharedGalleryImageVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGalleryImageVersion class. + /// + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + /// The published date of the gallery image + /// version Definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The end of life date of the gallery + /// image version Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + public SharedGalleryImageVersion(string name = default(string), string location = default(string), string uniqueId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?)) + : base(name, location, uniqueId) + { + PublishedDate = publishedDate; + EndOfLifeDate = endOfLifeDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the published date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.publishedDate")] + public System.DateTime? PublishedDate { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedToValues.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedToValues.cs new file mode 100644 index 0000000000000..463c15183c04c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedToValues.cs @@ -0,0 +1,21 @@ +// +// 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.Compute.Models +{ + + /// + /// Defines values for SharedToValues. + /// + public static class SharedToValues + { + public const string Tenant = "tenant"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfile.cs new file mode 100644 index 0000000000000..772a9e641f95d --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfile.cs @@ -0,0 +1,68 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile for gallery sharing to subscription or tenant + /// + public partial class SharingProfile + { + /// + /// Initializes a new instance of the SharingProfile class. + /// + public SharingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharingProfile class. + /// + /// This property allows you to specify the + /// permission of sharing gallery. <br><br> Possible values + /// are: <br><br> **Private** <br><br> + /// **Groups**. Possible values include: 'Private', 'Groups' + /// A list of sharing profile groups. + public SharingProfile(string permissions = default(string), IList groups = default(IList)) + { + Permissions = permissions; + Groups = groups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the permission of + /// sharing gallery. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; **Private** + /// &lt;br&gt;&lt;br&gt; **Groups**. Possible values + /// include: 'Private', 'Groups' + /// + [JsonProperty(PropertyName = "permissions")] + public string Permissions { get; set; } + + /// + /// Gets a list of sharing profile groups. + /// + [JsonProperty(PropertyName = "groups")] + public IList Groups { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroup.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroup.cs new file mode 100644 index 0000000000000..7a8e4df6262c4 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroup.cs @@ -0,0 +1,71 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Group of the gallery sharing profile + /// + public partial class SharingProfileGroup + { + /// + /// Initializes a new instance of the SharingProfileGroup class. + /// + public SharingProfileGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharingProfileGroup class. + /// + /// This property allows you to specify the type of + /// sharing group. <br><br> Possible values are: + /// <br><br> **Subscriptions** <br><br> + /// **AADTenants**. Possible values include: 'Subscriptions', + /// 'AADTenants' + /// A list of subscription/tenant ids the gallery is + /// aimed to be shared to. + public SharingProfileGroup(string type = default(string), IList ids = default(IList)) + { + Type = type; + Ids = ids; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the type of + /// sharing group. &lt;br&gt;&lt;br&gt; Possible values + /// are: &lt;br&gt;&lt;br&gt; **Subscriptions** + /// &lt;br&gt;&lt;br&gt; **AADTenants**. Possible + /// values include: 'Subscriptions', 'AADTenants' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets a list of subscription/tenant ids the gallery is aimed + /// to be shared to. + /// + [JsonProperty(PropertyName = "ids")] + public IList Ids { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroupTypes.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroupTypes.cs new file mode 100644 index 0000000000000..1f1724bed836d --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroupTypes.cs @@ -0,0 +1,22 @@ +// +// 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.Compute.Models +{ + + /// + /// Defines values for SharingProfileGroupTypes. + /// + public static class SharingProfileGroupTypes + { + public const string Subscriptions = "Subscriptions"; + public const string AADTenants = "AADTenants"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdate.cs new file mode 100644 index 0000000000000..a51aa0ad30dc7 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdate.cs @@ -0,0 +1,85 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery sharing profile update. + /// + public partial class SharingUpdate : IResource + { + /// + /// Initializes a new instance of the SharingUpdate class. + /// + public SharingUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharingUpdate class. + /// + /// This property allows you to specify the + /// operation type of gallery sharing update. <br><br> + /// Possible values are: <br><br> **Add** + /// <br><br> **Remove** <br><br> **Reset**. + /// Possible values include: 'Add', 'Remove', 'Reset' + /// A list of sharing profile groups. + public SharingUpdate(string operationType, IList groups = default(IList)) + { + OperationType = operationType; + Groups = groups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the operation type + /// of gallery sharing update. &lt;br&gt;&lt;br&gt; + /// Possible values are: &lt;br&gt;&lt;br&gt; **Add** + /// &lt;br&gt;&lt;br&gt; **Remove** + /// &lt;br&gt;&lt;br&gt; **Reset**. Possible values + /// include: 'Add', 'Remove', 'Reset' + /// + [JsonProperty(PropertyName = "operationType")] + public string OperationType { get; set; } + + /// + /// Gets or sets a list of sharing profile groups. + /// + [JsonProperty(PropertyName = "groups")] + public IList Groups { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OperationType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperationType"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdateOperationTypes.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdateOperationTypes.cs new file mode 100644 index 0000000000000..821acf46873ff --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdateOperationTypes.cs @@ -0,0 +1,23 @@ +// +// 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.Compute.Models +{ + + /// + /// Defines values for SharingUpdateOperationTypes. + /// + public static class SharingUpdateOperationTypes + { + public const string Add = "Add"; + public const string Remove = "Remove"; + public const string Reset = "Reset"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StatusCodeCount.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StatusCodeCount.cs new file mode 100644 index 0000000000000..58d751d63e8ef --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StatusCodeCount.cs @@ -0,0 +1,57 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class StatusCodeCount + { + /// + /// Initializes a new instance of the StatusCodeCount class. + /// + public StatusCodeCount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatusCodeCount class. + /// + /// The instance view status code + /// Number of instances having this status + /// code + public StatusCodeCount(string code = default(string), int? count = default(int?)) + { + Code = code; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the instance view status code + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets number of instances having this status code + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ThrottledRequestsInput.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ThrottledRequestsInput.cs index 6d74194924122..969e1d214be47 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ThrottledRequestsInput.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ThrottledRequestsInput.cs @@ -38,8 +38,12 @@ public ThrottledRequestsInput() /// Name. /// Group query result by Resource /// Name. - public ThrottledRequestsInput(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?)) - : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName) + /// Group query result by + /// Client Application ID. + /// Group query result by User + /// Agent. + public ThrottledRequestsInput(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?), bool? groupByClientApplicationId = default(bool?), bool? groupByUserAgent = default(bool?)) + : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent) { CustomInit(); } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateDomain.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateDomain.cs new file mode 100644 index 0000000000000..a70bab5d5e0df --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateDomain.cs @@ -0,0 +1,59 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines an update domain for the cloud service. + /// + public partial class UpdateDomain + { + /// + /// Initializes a new instance of the UpdateDomain class. + /// + public UpdateDomain() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateDomain class. + /// + /// Resource Id + /// Resource Name + public UpdateDomain(string id = default(string), string name = default(string)) + { + Id = id; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource Name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactManage.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactManage.cs new file mode 100644 index 0000000000000..c071bf5d91f4d --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactManage.cs @@ -0,0 +1,95 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class UserArtifactManage + { + /// + /// Initializes a new instance of the UserArtifactManage class. + /// + public UserArtifactManage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserArtifactManage class. + /// + /// Required. The path and arguments to install + /// the gallery application. This is limited to 4096 + /// characters. + /// Required. The path and arguments to remove the + /// gallery application. This is limited to 4096 characters. + /// Optional. The path and arguments to update the + /// gallery application. If not present, then update operation will + /// invoke remove command on the previous version and install command + /// on the current version of the gallery application. This is limited + /// to 4096 characters. + public UserArtifactManage(string install, string remove, string update = default(string)) + { + Install = install; + Remove = remove; + Update = update; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required. The path and arguments to install the + /// gallery application. This is limited to 4096 characters. + /// + [JsonProperty(PropertyName = "install")] + public string Install { get; set; } + + /// + /// Gets or sets required. The path and arguments to remove the gallery + /// application. This is limited to 4096 characters. + /// + [JsonProperty(PropertyName = "remove")] + public string Remove { get; set; } + + /// + /// Gets or sets optional. The path and arguments to update the gallery + /// application. If not present, then update operation will invoke + /// remove command on the previous version and install command on the + /// current version of the gallery application. This is limited to 4096 + /// characters. + /// + [JsonProperty(PropertyName = "update")] + public string Update { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Install == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Install"); + } + if (Remove == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Remove"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactSource.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactSource.cs index a37d1ec81227a..3af7ac1a8a5dc 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactSource.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactSource.cs @@ -30,14 +30,15 @@ public UserArtifactSource() /// /// Initializes a new instance of the UserArtifactSource class. /// - /// Required. The fileName of the - /// artifact. /// Required. The mediaLink of the artifact, - /// must be a readable storage blob. - public UserArtifactSource(string fileName, string mediaLink) + /// must be a readable storage page blob. + /// Optional. The + /// defaultConfigurationLink of the artifact, must be a readable + /// storage page blob. + public UserArtifactSource(string mediaLink, string defaultConfigurationLink = default(string)) { - FileName = fileName; MediaLink = mediaLink; + DefaultConfigurationLink = defaultConfigurationLink; CustomInit(); } @@ -46,19 +47,20 @@ public UserArtifactSource(string fileName, string mediaLink) /// partial void CustomInit(); - /// - /// Gets or sets required. The fileName of the artifact. - /// - [JsonProperty(PropertyName = "fileName")] - public string FileName { get; set; } - /// /// Gets or sets required. The mediaLink of the artifact, must be a - /// readable storage blob. + /// readable storage page blob. /// [JsonProperty(PropertyName = "mediaLink")] public string MediaLink { get; set; } + /// + /// Gets or sets optional. The defaultConfigurationLink of the + /// artifact, must be a readable storage page blob. + /// + [JsonProperty(PropertyName = "defaultConfigurationLink")] + public string DefaultConfigurationLink { get; set; } + /// /// Validate the object. /// @@ -67,10 +69,6 @@ public UserArtifactSource(string fileName, string mediaLink) /// public virtual void Validate() { - if (FileName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FileName"); - } if (MediaLink == null) { throw new ValidationException(ValidationRules.CannotBeNull, "MediaLink"); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachine.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachine.cs index 497be8511c7d8..53cc695fea8b5 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachine.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachine.cs @@ -119,15 +119,17 @@ public VirtualMachine() /// The virtual machine instance /// view. /// Specifies that the image or disk that is - /// being used was licensed on-premises. This element is only used for - /// images that contain the Windows Server operating system. - /// <br><br> Possible values are: <br><br> - /// Windows_Client <br><br> Windows_Server - /// <br><br> If this element is included in a request for - /// an update, the value must match the initial value. This value - /// cannot be updated. <br><br> For more information, see - /// [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// <br><br> Minimum api-version: 2015-06-15 /// Specifies the VM unique ID which is a 128-bits /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS @@ -348,16 +350,19 @@ public VirtualMachine() /// /// Gets or sets specifies that the image or disk that is being used - /// was licensed on-premises. This element is only used for images that - /// contain the Windows Server operating system. - /// &lt;br&gt;&lt;br&gt; Possible values are: + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: /// &lt;br&gt;&lt;br&gt; Windows_Client /// &lt;br&gt;&lt;br&gt; Windows_Server - /// &lt;br&gt;&lt;br&gt; If this element is included in - /// a request for an update, the value must match the initial value. - /// This value cannot be updated. &lt;br&gt;&lt;br&gt; - /// For more information, see [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// &lt;br&gt;&lt;br&gt; Minimum api-version: /// 2015-06-15 /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVM.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVM.cs index 42f9b67e1fd0f..f7611f16f7f6a 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVM.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVM.cs @@ -82,15 +82,17 @@ public VirtualMachineScaleSetVM() /// The provisioning state, which only /// appears in the response. /// Specifies that the image or disk that is - /// being used was licensed on-premises. This element is only used for - /// images that contain the Windows Server operating system. - /// <br><br> Possible values are: <br><br> - /// Windows_Client <br><br> Windows_Server - /// <br><br> If this element is included in a request for - /// an update, the value must match the initial value. This value - /// cannot be updated. <br><br> For more information, see - /// [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// <br><br> Minimum api-version: 2015-06-15 /// Specifies whether the model /// applied to the virtual machine is the model of the virtual machine @@ -255,16 +257,19 @@ public VirtualMachineScaleSetVM() /// /// Gets or sets specifies that the image or disk that is being used - /// was licensed on-premises. This element is only used for images that - /// contain the Windows Server operating system. - /// &lt;br&gt;&lt;br&gt; Possible values are: + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: /// &lt;br&gt;&lt;br&gt; Windows_Client /// &lt;br&gt;&lt;br&gt; Windows_Server - /// &lt;br&gt;&lt;br&gt; If this element is included in - /// a request for an update, the value must match the initial value. - /// This value cannot be updated. &lt;br&gt;&lt;br&gt; - /// For more information, see [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// &lt;br&gt;&lt;br&gt; Minimum api-version: /// 2015-06-15 /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtension.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtension.cs new file mode 100644 index 0000000000000..06226939c7c2c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtension.cs @@ -0,0 +1,170 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a VMSS VM Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetVMExtension : SubResourceReadOnly + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMExtension + /// class. + /// + public VirtualMachineScaleSetVMExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMExtension + /// class. + /// + /// Resource Id + /// The name of the extension. + /// Resource type + /// How the extension handler should be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// 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. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine extension instance + /// view. + public VirtualMachineScaleSetVMExtension(string id = default(string), string name = default(string), string type = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), VirtualMachineExtensionInstanceView instanceView = default(VirtualMachineExtensionInstanceView)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + InstanceView = instanceView; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets how the extension handler should be forced to update + /// even if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.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 = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.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 = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the virtual machine extension instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineExtensionInstanceView InstanceView { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs new file mode 100644 index 0000000000000..16cf7368378f6 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs @@ -0,0 +1,152 @@ +// +// 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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a VMSS VM Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetVMExtensionUpdate : SubResourceReadOnly + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionUpdate class. + /// + public VirtualMachineScaleSetVMExtensionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionUpdate class. + /// + /// Resource Id + /// The name of the extension. + /// Resource type + /// How the extension handler should be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// 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. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + public VirtualMachineScaleSetVMExtensionUpdate(string id = default(string), string name = default(string), string type = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets how the extension handler should be forced to update + /// even if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.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 = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.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 = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionsListResult.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionsListResult.cs new file mode 100644 index 0000000000000..1057fee97b376 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionsListResult.cs @@ -0,0 +1,55 @@ +// +// 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.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The List VMSS VM Extension operation response + /// + public partial class VirtualMachineScaleSetVMExtensionsListResult + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsListResult class. + /// + public VirtualMachineScaleSetVMExtensionsListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsListResult class. + /// + /// The list of VMSS VM extensions + public VirtualMachineScaleSetVMExtensionsListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of VMSS VM extensions + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProfile.cs index 0b95b2695cf38..ffa142b34ece2 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProfile.cs @@ -46,15 +46,17 @@ public VirtualMachineScaleSetVMProfile() /// for extensions installed on virtual machines in the scale /// set. /// Specifies that the image or disk that is - /// being used was licensed on-premises. This element is only used for - /// images that contain the Windows Server operating system. - /// <br><br> Possible values are: <br><br> - /// Windows_Client <br><br> Windows_Server - /// <br><br> If this element is included in a request for - /// an update, the value must match the initial value. This value - /// cannot be updated. <br><br> For more information, see - /// [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// <br><br> Minimum api-version: 2015-06-15 /// Specifies the priority for the virtual /// machines in the scale set. <br><br>Minimum api-version: @@ -139,16 +141,19 @@ public VirtualMachineScaleSetVMProfile() /// /// Gets or sets specifies that the image or disk that is being used - /// was licensed on-premises. This element is only used for images that - /// contain the Windows Server operating system. - /// &lt;br&gt;&lt;br&gt; Possible values are: + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: /// &lt;br&gt;&lt;br&gt; Windows_Client /// &lt;br&gt;&lt;br&gt; Windows_Server - /// &lt;br&gt;&lt;br&gt; If this element is included in - /// a request for an update, the value must match the initial value. - /// This value cannot be updated. &lt;br&gt;&lt;br&gt; - /// For more information, see [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// &lt;br&gt;&lt;br&gt; Minimum api-version: /// 2015-06-15 /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineUpdate.cs index 4704c63cde820..5a4f79543b848 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineUpdate.cs @@ -115,15 +115,17 @@ public VirtualMachineUpdate() /// The virtual machine instance /// view. /// Specifies that the image or disk that is - /// being used was licensed on-premises. This element is only used for - /// images that contain the Windows Server operating system. - /// <br><br> Possible values are: <br><br> - /// Windows_Client <br><br> Windows_Server - /// <br><br> If this element is included in a request for - /// an update, the value must match the initial value. This value - /// cannot be updated. <br><br> For more information, see - /// [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// <br><br> Minimum api-version: 2015-06-15 /// Specifies the VM unique ID which is a 128-bits /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS @@ -341,16 +343,19 @@ public VirtualMachineUpdate() /// /// Gets or sets specifies that the image or disk that is being used - /// was licensed on-premises. This element is only used for images that - /// contain the Windows Server operating system. - /// &lt;br&gt;&lt;br&gt; Possible values are: + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: /// &lt;br&gt;&lt;br&gt; Windows_Client /// &lt;br&gt;&lt;br&gt; Windows_Server - /// &lt;br&gt;&lt;br&gt; If this element is included in - /// a request for an update, the value must match the initial value. - /// This value cannot be updated. &lt;br&gt;&lt;br&gt; - /// For more information, see [Azure Hybrid Use Benefit for Windows - /// Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) /// &lt;br&gt;&lt;br&gt; Minimum api-version: /// 2015-06-15 /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs index 9094c86f8b994..f11e1286d7be7 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs @@ -20,21 +20,29 @@ public static IEnumerable> ApiInfo_ComputeManageme return new Tuple[] { new Tuple("Compute", "AvailabilitySets", "2020-06-01"), + new Tuple("Compute", "CloudServiceRoleInstances", "2020-10-01-preview"), + new Tuple("Compute", "CloudServiceRoles", "2020-10-01-preview"), + new Tuple("Compute", "CloudServices", "2020-10-01-preview"), + new Tuple("Compute", "CloudServicesUpdateDomain", "2020-10-01-preview"), new Tuple("Compute", "DedicatedHostGroups", "2020-06-01"), new Tuple("Compute", "DedicatedHosts", "2020-06-01"), new Tuple("Compute", "DiskAccesses", "2020-06-30"), new Tuple("Compute", "DiskEncryptionSets", "2020-06-30"), new Tuple("Compute", "Disks", "2020-06-30"), - new Tuple("Compute", "Galleries", "2019-12-01"), - new Tuple("Compute", "GalleryApplicationVersions", "2019-12-01"), - new Tuple("Compute", "GalleryApplications", "2019-12-01"), - new Tuple("Compute", "GalleryImageVersions", "2019-12-01"), - new Tuple("Compute", "GalleryImages", "2019-12-01"), + new Tuple("Compute", "Galleries", "2020-09-30"), + new Tuple("Compute", "GalleryApplicationVersions", "2020-09-30"), + new Tuple("Compute", "GalleryApplications", "2020-09-30"), + new Tuple("Compute", "GalleryImageVersions", "2020-09-30"), + new Tuple("Compute", "GalleryImages", "2020-09-30"), + new Tuple("Compute", "GallerySharingProfile", "2020-09-30"), new Tuple("Compute", "Images", "2020-06-01"), new Tuple("Compute", "LogAnalytics", "2020-06-01"), new Tuple("Compute", "Operations", "2020-06-01"), new Tuple("Compute", "ProximityPlacementGroups", "2020-06-01"), new Tuple("Compute", "ResourceSkus", "2019-04-01"), + new Tuple("Compute", "SharedGalleries", "2020-09-30"), + new Tuple("Compute", "SharedGalleryImageVersions", "2020-09-30"), + new Tuple("Compute", "SharedGalleryImages", "2020-09-30"), new Tuple("Compute", "Snapshots", "2020-06-30"), new Tuple("Compute", "SshPublicKeys", "2020-06-01"), new Tuple("Compute", "Usage", "2020-06-01"), @@ -54,16 +62,5 @@ public static IEnumerable> ApiInfo_ComputeManageme }.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/compute/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=E:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "1959aa63dd7a626aac36cc0e6b8c656dd2c1791d"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperations.cs new file mode 100644 index 0000000000000..409b39892dba7 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperations.cs @@ -0,0 +1,615 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleriesOperations operations. + /// + internal partial class SharedGalleriesOperations : IServiceOperations, ISharedGalleriesOperations + { + /// + /// Initializes a new instance of the SharedGalleriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SharedGalleriesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + string apiVersion = "2020-09-30"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("sharedTo", sharedTo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (sharedTo != null) + { + _queryParameters.Add(string.Format("sharedTo={0}", System.Uri.EscapeDataString(sharedTo))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + string apiVersion = "2020-09-30"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperationsExtensions.cs new file mode 100644 index 0000000000000..fbc46821ac944 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperationsExtensions.cs @@ -0,0 +1,141 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SharedGalleriesOperations. + /// + public static partial class SharedGalleriesOperationsExtensions + { + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + public static IPage List(this ISharedGalleriesOperations operations, string location, string sharedTo = default(string)) + { + return operations.ListAsync(location, sharedTo).GetAwaiter().GetResult(); + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISharedGalleriesOperations operations, string location, string sharedTo = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, sharedTo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + public static SharedGallery Get(this ISharedGalleriesOperations operations, string location, string galleryUniqueName) + { + return operations.GetAsync(location, galleryUniqueName).GetAwaiter().GetResult(); + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISharedGalleriesOperations operations, string location, string galleryUniqueName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, galleryUniqueName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISharedGalleriesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISharedGalleriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperations.cs new file mode 100644 index 0000000000000..f86e48b89e023 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperations.cs @@ -0,0 +1,656 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImageVersionsOperations operations. + /// + internal partial class SharedGalleryImageVersionsOperations : IServiceOperations, ISharedGalleryImageVersionsOperations + { + /// + /// Initializes a new instance of the SharedGalleryImageVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SharedGalleryImageVersionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2020-09-30"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("sharedTo", sharedTo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (sharedTo != null) + { + _queryParameters.Add(string.Format("sharedTo={0}", System.Uri.EscapeDataString(sharedTo))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + string apiVersion = "2020-09-30"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("cancellationToken", cancellationToken); + 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}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperationsExtensions.cs new file mode 100644 index 0000000000000..30ce93c9da327 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperationsExtensions.cs @@ -0,0 +1,175 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SharedGalleryImageVersionsOperations. + /// + public static partial class SharedGalleryImageVersionsOperationsExtensions + { + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + public static IPage List(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string)) + { + return operations.ListAsync(location, galleryUniqueName, galleryImageName, sharedTo).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, galleryUniqueName, galleryImageName, sharedTo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + public static SharedGalleryImageVersion Get(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName) + { + return operations.GetAsync(location, galleryUniqueName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, galleryUniqueName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISharedGalleryImageVersionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISharedGalleryImageVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperations.cs new file mode 100644 index 0000000000000..e6d129ddf34db --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperations.cs @@ -0,0 +1,634 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImagesOperations operations. + /// + internal partial class SharedGalleryImagesOperations : IServiceOperations, ISharedGalleryImagesOperations + { + /// + /// Initializes a new instance of the SharedGalleryImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SharedGalleryImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + string apiVersion = "2020-09-30"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("sharedTo", sharedTo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (sharedTo != null) + { + _queryParameters.Add(string.Format("sharedTo={0}", System.Uri.EscapeDataString(sharedTo))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2020-09-30"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("cancellationToken", cancellationToken); + 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}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperationsExtensions.cs new file mode 100644 index 0000000000000..6f7b97ca6e915 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperationsExtensions.cs @@ -0,0 +1,155 @@ +// +// 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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SharedGalleryImagesOperations. + /// + public static partial class SharedGalleryImagesOperationsExtensions + { + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + public static IPage List(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string sharedTo = default(string)) + { + return operations.ListAsync(location, galleryUniqueName, sharedTo).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string sharedTo = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, galleryUniqueName, sharedTo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + public static SharedGalleryImage Get(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string galleryImageName) + { + return operations.GetAsync(location, galleryUniqueName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, galleryUniqueName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISharedGalleryImagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISharedGalleryImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs index 35fa17d315b38..0447703927e21 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs @@ -74,10 +74,10 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -105,10 +105,10 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -179,7 +179,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -328,7 +328,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl 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")) @@ -341,7 +341,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -397,7 +397,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl /// /// A response object containing the response body and response headers. /// - public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -540,7 +540,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl 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")) @@ -553,7 +553,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -611,7 +611,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -633,10 +633,6 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl { throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); } - if (extensionParameters != null) - { - extensionParameters.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -770,7 +766,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl 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")) @@ -783,7 +779,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -801,7 +797,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -859,7 +855,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1014,7 +1010,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl 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")) @@ -1027,7 +1023,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs index be93828f83676..2bd9dea48e92f 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs @@ -42,7 +42,7 @@ public static partial class VirtualMachineScaleSetVMExtensionsOperationsExtensio /// /// Parameters supplied to the Create Virtual Machine Extension operation. /// - public static VirtualMachineExtension CreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters) + public static VirtualMachineScaleSetVMExtension CreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters) { return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); } @@ -71,7 +71,7 @@ public static VirtualMachineExtension CreateOrUpdate(this IVirtualMachineScaleSe /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) { @@ -100,7 +100,7 @@ public static VirtualMachineExtension CreateOrUpdate(this IVirtualMachineScaleSe /// /// Parameters supplied to the Update Virtual Machine Extension operation. /// - public static VirtualMachineExtension Update(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + public static VirtualMachineScaleSetVMExtension Update(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters) { return operations.UpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); } @@ -129,7 +129,7 @@ public static VirtualMachineExtension Update(this IVirtualMachineScaleSetVMExten /// /// The cancellation token. /// - public static async Task UpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) { @@ -207,7 +207,7 @@ public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations ope /// /// The expand expression to apply on the operation. /// - public static VirtualMachineExtension Get(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string)) + public static VirtualMachineScaleSetVMExtension Get(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string)) { return operations.GetAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand).GetAwaiter().GetResult(); } @@ -236,7 +236,7 @@ public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations ope /// /// The cancellation token. /// - public static async Task GetAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) { @@ -263,7 +263,7 @@ public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations ope /// /// The expand expression to apply on the operation. /// - public static VirtualMachineExtensionsListResult List(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string)) + public static VirtualMachineScaleSetVMExtensionsListResult List(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string)) { return operations.ListAsync(resourceGroupName, vmScaleSetName, instanceId, expand).GetAwaiter().GetResult(); } @@ -290,7 +290,7 @@ public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations ope /// /// The cancellation token. /// - public static async Task ListAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, expand, null, cancellationToken).ConfigureAwait(false)) { @@ -319,7 +319,7 @@ public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations ope /// /// Parameters supplied to the Create Virtual Machine Extension operation. /// - public static VirtualMachineExtension BeginCreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters) + public static VirtualMachineScaleSetVMExtension BeginCreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters) { return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); } @@ -348,7 +348,7 @@ public static VirtualMachineExtension BeginCreateOrUpdate(this IVirtualMachineSc /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) { @@ -377,7 +377,7 @@ public static VirtualMachineExtension BeginCreateOrUpdate(this IVirtualMachineSc /// /// Parameters supplied to the Update Virtual Machine Extension operation. /// - public static VirtualMachineExtension BeginUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + public static VirtualMachineScaleSetVMExtension BeginUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters) { return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); } @@ -406,7 +406,7 @@ public static VirtualMachineExtension BeginUpdate(this IVirtualMachineScaleSetVM /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs index 7c170b6402a66..443773a98417b 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs @@ -329,16 +329,19 @@ internal VirtualMachinesOperations(ComputeManagementClient client) /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -2804,6 +2807,9 @@ internal VirtualMachinesOperations(ComputeManagementClient client) /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines. + /// /// /// Headers that will be added to request. /// @@ -2822,7 +2828,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2846,6 +2852,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vmName", vmName); + tracingParameters.Add("forceDeletion", forceDeletion); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); @@ -2857,6 +2864,10 @@ internal VirtualMachinesOperations(ComputeManagementClient client) _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (forceDeletion != null) + { + _queryParameters.Add(string.Format("forceDeletion={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDeletion, Client.SerializationSettings).Trim('"')))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs index 495ef93f9b68c..17ea6694c4c72 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs @@ -213,9 +213,12 @@ public static VirtualMachine Update(this IVirtualMachinesOperations operations, /// /// The name of the virtual machine. /// - public static void Delete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + /// + /// Optional parameter to force delete virtual machines. + /// + public static void Delete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?)) { - operations.DeleteAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, vmName, forceDeletion).GetAwaiter().GetResult(); } /// @@ -230,12 +233,15 @@ public static void Delete(this IVirtualMachinesOperations operations, string res /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines. + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1187,9 +1193,12 @@ public static VirtualMachine BeginUpdate(this IVirtualMachinesOperations operati /// /// The name of the virtual machine. /// - public static void BeginDelete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + /// + /// Optional parameter to force delete virtual machines. + /// + public static void BeginDelete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?)) { - operations.BeginDeleteAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, vmName, forceDeletion).GetAwaiter().GetResult(); } /// @@ -1204,12 +1213,15 @@ public static void BeginDelete(this IVirtualMachinesOperations operations, strin /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines. + /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } ///