diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs new file mode 100644 index 0000000000000..a68b33a6ee12d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs @@ -0,0 +1,1752 @@ +// +// 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; + + /// + /// AvailabilitySetsOperations operations. + /// + internal partial class AvailabilitySetsOperations : IServiceOperations, IAvailabilitySetsOperations + { + /// + /// Initializes a new instance of the AvailabilitySetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AvailabilitySetsOperations(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 an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _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) + { + 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; + } + + /// + /// Update an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _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; + } + + /// + /// Delete an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _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 != 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; + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// 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 availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + 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/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _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; + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// '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>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets").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 (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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; + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The 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-12-01"; + // 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/availabilitySets").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; + } + + /// + /// Lists all available virtual machine sizes that can be used to create a new + /// virtual machine in an existing availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// 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>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAvailableSizes", 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/availabilitySets/{availabilitySetName}/vmSizes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _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; + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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; + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperationsExtensions.cs new file mode 100644 index 0000000000000..b65d43682dacc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperationsExtensions.cs @@ -0,0 +1,376 @@ +// +// 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 AvailabilitySetsOperations. + /// + public static partial class AvailabilitySetsOperationsExtensions + { + /// + /// Create or update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set operation. + /// + public static AvailabilitySet CreateOrUpdate(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySet parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, availabilitySetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySet parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, availabilitySetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set operation. + /// + public static AvailabilitySet Update(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, availabilitySetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, availabilitySetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + public static void Delete(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName) + { + operations.DeleteAsync(resourceGroupName, availabilitySetName).GetAwaiter().GetResult(); + } + + /// + /// Delete an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, availabilitySetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + public static AvailabilitySet Get(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName) + { + return operations.GetAsync(resourceGroupName, availabilitySetName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, availabilitySetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// 'instanceView'. + /// + public static IPage ListBySubscription(this IAvailabilitySetsOperations operations, string expand = default(string)) + { + return operations.ListBySubscriptionAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// 'instanceView'. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IAvailabilitySetsOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage List(this IAvailabilitySetsOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all available virtual machine sizes that can be used to create a new + /// virtual machine in an existing availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + public static IEnumerable ListAvailableSizes(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName) + { + return operations.ListAvailableSizesAsync(resourceGroupName, availabilitySetName).GetAwaiter().GetResult(); + } + + /// + /// Lists all available virtual machine sizes that can be used to create a new + /// virtual machine in an existing availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAvailableSizesAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAvailableSizesWithHttpMessagesAsync(resourceGroupName, availabilitySetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IAvailabilitySetsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IAvailabilitySetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAvailabilitySetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// 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 IAvailabilitySetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs new file mode 100644 index 0000000000000..7fe57d533cfa3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs @@ -0,0 +1,566 @@ +// +// 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 Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// Compute Client + /// + public partial class ComputeManagementClient : ServiceClient, IComputeManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Subscription credentials which uniquely identify Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every service + /// call. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IAvailabilitySetsOperations. + /// + public virtual IAvailabilitySetsOperations AvailabilitySets { get; private set; } + + /// + /// Gets the IProximityPlacementGroupsOperations. + /// + public virtual IProximityPlacementGroupsOperations ProximityPlacementGroups { get; private set; } + + /// + /// Gets the IDedicatedHostGroupsOperations. + /// + public virtual IDedicatedHostGroupsOperations DedicatedHostGroups { get; private set; } + + /// + /// Gets the IDedicatedHostsOperations. + /// + public virtual IDedicatedHostsOperations DedicatedHosts { get; private set; } + + /// + /// Gets the ISshPublicKeysOperations. + /// + public virtual ISshPublicKeysOperations SshPublicKeys { get; private set; } + + /// + /// Gets the IVirtualMachineExtensionImagesOperations. + /// + public virtual IVirtualMachineExtensionImagesOperations VirtualMachineExtensionImages { get; private set; } + + /// + /// Gets the IVirtualMachineExtensionsOperations. + /// + public virtual IVirtualMachineExtensionsOperations VirtualMachineExtensions { get; private set; } + + /// + /// Gets the IVirtualMachineImagesOperations. + /// + public virtual IVirtualMachineImagesOperations VirtualMachineImages { get; private set; } + + /// + /// Gets the IVirtualMachineImagesEdgeZoneOperations. + /// + public virtual IVirtualMachineImagesEdgeZoneOperations VirtualMachineImagesEdgeZone { get; private set; } + + /// + /// Gets the IUsageOperations. + /// + public virtual IUsageOperations Usage { get; private set; } + + /// + /// Gets the IVirtualMachinesOperations. + /// + public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetsOperations. + /// + public virtual IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; private set; } + + /// + /// Gets the IVirtualMachineSizesOperations. + /// + public virtual IVirtualMachineSizesOperations VirtualMachineSizes { get; private set; } + + /// + /// Gets the IImagesOperations. + /// + public virtual IImagesOperations Images { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetExtensionsOperations. + /// + public virtual IVirtualMachineScaleSetExtensionsOperations VirtualMachineScaleSetExtensions { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetRollingUpgradesOperations. + /// + public virtual IVirtualMachineScaleSetRollingUpgradesOperations VirtualMachineScaleSetRollingUpgrades { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetVMExtensionsOperations. + /// + public virtual IVirtualMachineScaleSetVMExtensionsOperations VirtualMachineScaleSetVMExtensions { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetVMsOperations. + /// + public virtual IVirtualMachineScaleSetVMsOperations VirtualMachineScaleSetVMs { get; private set; } + + /// + /// Gets the ILogAnalyticsOperations. + /// + public virtual ILogAnalyticsOperations LogAnalytics { get; private set; } + + /// + /// Gets the IVirtualMachineRunCommandsOperations. + /// + public virtual IVirtualMachineRunCommandsOperations VirtualMachineRunCommands { get; private set; } + + /// + /// Gets the IResourceSkusOperations. + /// + public virtual IResourceSkusOperations ResourceSkus { get; private set; } + + /// + /// Gets the IDisksOperations. + /// + public virtual IDisksOperations Disks { get; private set; } + + /// + /// Gets the ISnapshotsOperations. + /// + public virtual ISnapshotsOperations Snapshots { get; private set; } + + /// + /// Gets the IDiskEncryptionSetsOperations. + /// + public virtual IDiskEncryptionSetsOperations DiskEncryptionSets { get; private set; } + + /// + /// Gets the IDiskAccessesOperations. + /// + public virtual IDiskAccessesOperations DiskAccesses { get; private set; } + + /// + /// Gets the IGalleriesOperations. + /// + public virtual IGalleriesOperations Galleries { get; private set; } + + /// + /// Gets the IGalleryImagesOperations. + /// + public virtual IGalleryImagesOperations GalleryImages { get; private set; } + + /// + /// Gets the IGalleryImageVersionsOperations. + /// + public virtual IGalleryImageVersionsOperations GalleryImageVersions { get; private set; } + + /// + /// Gets the IGalleryApplicationsOperations. + /// + public virtual IGalleryApplicationsOperations GalleryApplications { get; private set; } + + /// + /// Gets the IGalleryApplicationVersionsOperations. + /// + 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; } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ComputeManagementClient.Dispose(). False: will not dispose provided httpClient + protected ComputeManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ComputeManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ComputeManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ComputeManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ComputeManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ComputeManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Operations = new Operations(this); + AvailabilitySets = new AvailabilitySetsOperations(this); + ProximityPlacementGroups = new ProximityPlacementGroupsOperations(this); + DedicatedHostGroups = new DedicatedHostGroupsOperations(this); + DedicatedHosts = new DedicatedHostsOperations(this); + SshPublicKeys = new SshPublicKeysOperations(this); + VirtualMachineExtensionImages = new VirtualMachineExtensionImagesOperations(this); + VirtualMachineExtensions = new VirtualMachineExtensionsOperations(this); + VirtualMachineImages = new VirtualMachineImagesOperations(this); + VirtualMachineImagesEdgeZone = new VirtualMachineImagesEdgeZoneOperations(this); + Usage = new UsageOperations(this); + VirtualMachines = new VirtualMachinesOperations(this); + VirtualMachineScaleSets = new VirtualMachineScaleSetsOperations(this); + VirtualMachineSizes = new VirtualMachineSizesOperations(this); + Images = new ImagesOperations(this); + VirtualMachineScaleSetExtensions = new VirtualMachineScaleSetExtensionsOperations(this); + VirtualMachineScaleSetRollingUpgrades = new VirtualMachineScaleSetRollingUpgradesOperations(this); + VirtualMachineScaleSetVMExtensions = new VirtualMachineScaleSetVMExtensionsOperations(this); + VirtualMachineScaleSetVMs = new VirtualMachineScaleSetVMsOperations(this); + LogAnalytics = new LogAnalyticsOperations(this); + VirtualMachineRunCommands = new VirtualMachineRunCommandsOperations(this); + ResourceSkus = new ResourceSkusOperations(this); + Disks = new DisksOperations(this); + Snapshots = new SnapshotsOperations(this); + DiskEncryptionSets = new DiskEncryptionSetsOperations(this); + DiskAccesses = new DiskAccessesOperations(this); + Galleries = new GalleriesOperations(this); + GalleryImages = new GalleryImagesOperations(this); + 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); + BaseUri = new System.Uri("https://management.azure.com"); + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/ContainerServicesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ContainerServicesOperations.cs new file mode 100644 index 0000000000000..2a997351885a6 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ContainerServicesOperations.cs @@ -0,0 +1,1482 @@ +// +// 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; + + /// + /// ContainerServicesOperations operations. + /// + internal partial class ContainerServicesOperations : IServiceOperations, IContainerServicesOperations + { + /// + /// Initializes a new instance of the ContainerServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ContainerServicesOperations(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 list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. The + /// operation returns properties of each container service including state, + /// orchestrator, number of masters and agents, and FQDNs of masters and + /// agents. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-01-31"; + // 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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices").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; + } + + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified configuration of + /// orchestrator, masters, and agents. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string containerServiceName, ContainerService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, containerServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of the specified container service. + /// + /// + /// Gets the properties of the specified container service in the specified + /// subscription and resource group. The operation returns the properties + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string containerServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (containerServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "containerServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-01-31"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("containerServiceName", containerServiceName); + 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.ContainerService/containerServices/{containerServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{containerServiceName}", System.Uri.EscapeDataString(containerServiceName)); + _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; + } + + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified subscription and + /// resource group. The operation does not delete other resources created as + /// part of creating a container service, including storage accounts, VMs, and + /// availability sets. All the other resources created with the container + /// service are part of the same resource group and can be deleted + /// individually. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string containerServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, containerServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(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 = "2017-01-31"; + // 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, "ListByResourceGroup", 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.ContainerService/containerServices").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; + } + + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified configuration of + /// orchestrator, masters, and agents. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string containerServiceName, ContainerService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (containerServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "containerServiceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-01-31"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("containerServiceName", containerServiceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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.ContainerService/containerServices/{containerServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{containerServiceName}", System.Uri.EscapeDataString(containerServiceName)); + _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 && (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 == 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); + } + } + // 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; + } + + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified subscription and + /// resource group. The operation does not delete other resources created as + /// part of creating a container service, including storage accounts, VMs, and + /// availability sets. All the other resources created with the container + /// service are part of the same resource group and can be deleted + /// individually. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// 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 containerServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (containerServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "containerServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-01-31"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("containerServiceName", containerServiceName); + 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.ContainerService/containerServices/{containerServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{containerServiceName}", System.Uri.EscapeDataString(containerServiceName)); + _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 != 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; + } + + /// + /// Gets a list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. The + /// operation returns properties of each container service including state, + /// orchestrator, number of masters and agents, and FQDNs of masters and + /// agents. + /// + /// + /// 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; + } + + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/ContainerServicesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ContainerServicesOperationsExtensions.cs new file mode 100644 index 0000000000000..e245c862dd38f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ContainerServicesOperationsExtensions.cs @@ -0,0 +1,479 @@ +// +// 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 ContainerServicesOperations. + /// + public static partial class ContainerServicesOperationsExtensions + { + /// + /// Gets a list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. The + /// operation returns properties of each container service including state, + /// orchestrator, number of masters and agents, and FQDNs of masters and + /// agents. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IContainerServicesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. The + /// operation returns properties of each container service including state, + /// orchestrator, number of masters and agents, and FQDNs of masters and + /// agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IContainerServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified configuration of + /// orchestrator, masters, and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service operation. + /// + public static ContainerService CreateOrUpdate(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName, ContainerService parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, containerServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified configuration of + /// orchestrator, masters, and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName, ContainerService parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, containerServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the properties of the specified container service. + /// + /// + /// Gets the properties of the specified container service in the specified + /// subscription and resource group. The operation returns the properties + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + public static ContainerService Get(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName) + { + return operations.GetAsync(resourceGroupName, containerServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified container service. + /// + /// + /// Gets the properties of the specified container service in the specified + /// subscription and resource group. The operation returns the properties + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, containerServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified subscription and + /// resource group. The operation does not delete other resources created as + /// part of creating a container service, including storage accounts, VMs, and + /// availability sets. All the other resources created with the container + /// service are part of the same resource group and can be deleted + /// individually. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + public static void Delete(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName) + { + operations.DeleteAsync(resourceGroupName, containerServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified subscription and + /// resource group. The operation does not delete other resources created as + /// part of creating a container service, including storage accounts, VMs, and + /// availability sets. All the other resources created with the container + /// service are part of the same resource group and can be deleted + /// individually. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, containerServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IContainerServicesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IContainerServicesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified configuration of + /// orchestrator, masters, and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service operation. + /// + public static ContainerService BeginCreateOrUpdate(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName, ContainerService parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, containerServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified configuration of + /// orchestrator, masters, and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName, ContainerService parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, containerServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified subscription and + /// resource group. The operation does not delete other resources created as + /// part of creating a container service, including storage accounts, VMs, and + /// availability sets. All the other resources created with the container + /// service are part of the same resource group and can be deleted + /// individually. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + public static void BeginDelete(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName) + { + operations.BeginDeleteAsync(resourceGroupName, containerServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified subscription and + /// resource group. The operation does not delete other resources created as + /// part of creating a container service, including storage accounts, VMs, and + /// availability sets. All the other resources created with the container + /// service are part of the same resource group and can be deleted + /// individually. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IContainerServicesOperations operations, string resourceGroupName, string containerServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, containerServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. The + /// operation returns properties of each container service including state, + /// orchestrator, number of masters and agents, and FQDNs of masters and + /// agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IContainerServicesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. The + /// operation returns properties of each container service including state, + /// orchestrator, number of masters and agents, and FQDNs of masters and + /// agents. + /// + /// + /// 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 IContainerServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IContainerServicesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and FQDNs of + /// masters and agents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IContainerServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs new file mode 100644 index 0000000000000..076bab87a29d3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs @@ -0,0 +1,1586 @@ +// +// 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; + + /// + /// DedicatedHostGroupsOperations operations. + /// + internal partial class DedicatedHostGroupsOperations : IServiceOperations, IDedicatedHostGroupsOperations + { + /// + /// Initializes a new instance of the DedicatedHostGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DedicatedHostGroupsOperations(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 dedicated host group. For details of Dedicated Host and + /// Dedicated Host Groups please see [Dedicated Host Documentation] + /// (https://go.microsoft.com/fwlink/?linkid=2082596) + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _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 an dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _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; + } + + /// + /// Delete a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _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 != 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; + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. The response shows the + /// list of instance view of the dedicated hosts under the dedicated host + /// group. 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 resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("expand", expand); + 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/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(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-12-01"; + // 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, "ListByResourceGroup", 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/hostGroups").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; + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups").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; + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperationsExtensions.cs new file mode 100644 index 0000000000000..d5f081ef95a34 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperationsExtensions.cs @@ -0,0 +1,354 @@ +// +// 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 DedicatedHostGroupsOperations. + /// + public static partial class DedicatedHostGroupsOperationsExtensions + { + /// + /// Create or update a dedicated host group. For details of Dedicated Host and + /// Dedicated Host Groups please see [Dedicated Host Documentation] + /// (https://go.microsoft.com/fwlink/?linkid=2082596) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host Group. + /// + public static DedicatedHostGroup CreateOrUpdate(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, hostGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a dedicated host group. For details of Dedicated Host and + /// Dedicated Host Groups please see [Dedicated Host Documentation] + /// (https://go.microsoft.com/fwlink/?linkid=2082596) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host Group. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group operation. + /// + public static DedicatedHostGroup Update(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, hostGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + public static void Delete(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName) + { + operations.DeleteAsync(resourceGroupName, hostGroupName).GetAwaiter().GetResult(); + } + + /// + /// Delete a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. The response shows the + /// list of instance view of the dedicated hosts under the dedicated host + /// group. Possible values include: 'instanceView' + /// + public static DedicatedHostGroup Get(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, hostGroupName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. The response shows the + /// list of instance view of the dedicated hosts under the dedicated host + /// group. Possible values include: 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, hostGroupName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDedicatedHostGroupsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IDedicatedHostGroupsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IDedicatedHostGroupsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDedicatedHostGroupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDedicatedHostGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IDedicatedHostGroupsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IDedicatedHostGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs new file mode 100644 index 0000000000000..6bb551e9fc243 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs @@ -0,0 +1,1356 @@ +// +// 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; + + /// + /// DedicatedHostsOperations operations. + /// + internal partial class DedicatedHostsOperations : IServiceOperations, IDedicatedHostsOperations + { + /// + /// Initializes a new instance of the DedicatedHostsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DedicatedHostsOperations(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 dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on 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 resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("expand", expand); + 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/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host 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>> ListByHostGroupWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByHostGroup", 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/hostGroups/{hostGroupName}/hosts").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _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; + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// 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 hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _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 an dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _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; + } + + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// 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 hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + 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/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _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; + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// 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>> ListByHostGroupNextWithHttpMessagesAsync(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, "ListByHostGroupNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperationsExtensions.cs new file mode 100644 index 0000000000000..4401399249d61 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperationsExtensions.cs @@ -0,0 +1,455 @@ +// +// 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 DedicatedHostsOperations. + /// + public static partial class DedicatedHostsOperationsExtensions + { + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + public static DedicatedHost CreateOrUpdate(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + public static DedicatedHost Update(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + public static void Delete(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName) + { + operations.DeleteAsync(resourceGroupName, hostGroupName, hostName).GetAwaiter().GetResult(); + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'instanceView' + /// + public static DedicatedHost Get(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, hostGroupName, hostName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + public static IPage ListByHostGroup(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName) + { + return operations.ListByHostGroupAsync(resourceGroupName, hostGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByHostGroupAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByHostGroupWithHttpMessagesAsync(resourceGroupName, hostGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + public static DedicatedHost BeginCreateOrUpdate(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + public static DedicatedHost BeginUpdate(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + public static void BeginDelete(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName) + { + operations.BeginDeleteAsync(resourceGroupName, hostGroupName, hostName).GetAwaiter().GetResult(); + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByHostGroupNext(this IDedicatedHostsOperations operations, string nextPageLink) + { + return operations.ListByHostGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByHostGroupNextAsync(this IDedicatedHostsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByHostGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperations.cs new file mode 100644 index 0000000000000..0cdf0da155a82 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperations.cs @@ -0,0 +1,1875 @@ +// +// 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; + + /// + /// DiskAccessesOperations operations. + /// + internal partial class DiskAccessesOperations : IServiceOperations, IDiskAccessesOperations + { + /// + /// Initializes a new instance of the DiskAccessesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskAccessesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, diskAccess, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskAccessName, 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 (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2020-06-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("diskAccessName", diskAccessName); + 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/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + 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; + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskAccessName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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"); + } + string apiVersion = "2020-06-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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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/diskAccesses").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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; + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-06-30"; + // 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, "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/diskAccesses").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 the private link resources possible under disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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> GetPrivateLinkResourcesWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, 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 (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2020-06-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("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetPrivateLinkResources", 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/diskAccesses/{diskAccessName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + 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; + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, 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 (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + if (diskAccess == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccess"); + } + if (diskAccess != null) + { + diskAccess.Validate(); + } + string apiVersion = "2020-06-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("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskAccess", diskAccess); + 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/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + 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(diskAccess != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskAccess, 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; + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskAccessName, IDictionary tags = default(IDictionary), 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 (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2020-06-30"; + DiskAccessUpdate diskAccess = new DiskAccessUpdate(); + if (tags != null) + { + diskAccess.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("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskAccess", diskAccess); + 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/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + 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(diskAccess != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskAccess, 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; + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskAccessName, 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 (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2020-06-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("diskAccessName", diskAccessName); + 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/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + 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; + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperationsExtensions.cs new file mode 100644 index 0000000000000..ac8a49af2ba7a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperationsExtensions.cs @@ -0,0 +1,543 @@ +// +// 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 DiskAccessesOperations. + /// + public static partial class DiskAccessesOperationsExtensions + { + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + public static DiskAccess CreateOrUpdate(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, diskAccess, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + public static DiskAccess Update(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, diskAccessName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static DiskAccess Get(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + return operations.GetAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static void Delete(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + operations.DeleteAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDiskAccessesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDiskAccessesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDiskAccessesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDiskAccessesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the private link resources possible under disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static PrivateLinkResourceListResult GetPrivateLinkResources(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + return operations.GetPrivateLinkResourcesAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources possible under disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetPrivateLinkResourcesAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPrivateLinkResourcesWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + public static DiskAccess BeginCreateOrUpdate(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, diskAccess, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + public static DiskAccess BeginUpdate(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, diskAccessName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static void BeginDelete(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + operations.BeginDeleteAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDiskAccessesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDiskAccessesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDiskAccessesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// 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 IDiskAccessesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs new file mode 100644 index 0000000000000..a57a1ac8bf664 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs @@ -0,0 +1,2051 @@ +// +// 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; + + /// + /// DiskEncryptionSetsOperations operations. + /// + internal partial class DiskEncryptionSetsOperations : IServiceOperations, IDiskEncryptionSetsOperations + { + /// + /// Initializes a new instance of the DiskEncryptionSetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskEncryptionSetsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskEncryptionSetName, 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 (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2020-06-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("diskEncryptionSetName", diskEncryptionSetName); + 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/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + 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; + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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"); + } + string apiVersion = "2020-06-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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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/diskEncryptionSets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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; + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-06-30"; + // 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, "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/diskEncryptionSets").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; + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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>> ListAssociatedResourcesWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, 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 (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2020-06-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("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAssociatedResources", 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/diskEncryptionSets/{diskEncryptionSetName}/associatedResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + 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; + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, 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 (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + if (diskEncryptionSet == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSet"); + } + if (diskEncryptionSet != null) + { + diskEncryptionSet.Validate(); + } + string apiVersion = "2020-06-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("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskEncryptionSet", diskEncryptionSet); + 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/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + 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(diskEncryptionSet != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskEncryptionSet, 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; + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, 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 (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + if (diskEncryptionSet == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSet"); + } + string apiVersion = "2020-06-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("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskEncryptionSet", diskEncryptionSet); + 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/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + 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(diskEncryptionSet != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskEncryptionSet, 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; + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskEncryptionSetName, 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 (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2020-06-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("diskEncryptionSetName", diskEncryptionSetName); + 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/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + 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; + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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; + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// 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>> ListAssociatedResourcesNextWithHttpMessagesAsync(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, "ListAssociatedResourcesNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperationsExtensions.cs new file mode 100644 index 0000000000000..21664ad9938fb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperationsExtensions.cs @@ -0,0 +1,583 @@ +// +// 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 DiskEncryptionSetsOperations. + /// + public static partial class DiskEncryptionSetsOperationsExtensions + { + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + public static DiskEncryptionSet CreateOrUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + public static DiskEncryptionSet Update(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) + { + return operations.UpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static DiskEncryptionSet Get(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + return operations.GetAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static void Delete(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + operations.DeleteAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDiskEncryptionSetsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDiskEncryptionSetsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDiskEncryptionSetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static IPage ListAssociatedResources(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + return operations.ListAssociatedResourcesAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAssociatedResourcesAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAssociatedResourcesWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + public static DiskEncryptionSet BeginCreateOrUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + public static DiskEncryptionSet BeginUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) + { + return operations.BeginUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static void BeginDelete(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + operations.BeginDeleteAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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 IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAssociatedResourcesNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListAssociatedResourcesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAssociatedResourcesNextAsync(this IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAssociatedResourcesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs new file mode 100644 index 0000000000000..aecb66b46cb5f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs @@ -0,0 +1,2110 @@ +// +// 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; + + /// + /// DisksOperations operations. + /// + internal partial class DisksOperations : IServiceOperations, IDisksOperations + { + /// + /// Initializes a new instance of the DisksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DisksOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// 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 diskName, 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 (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + string apiVersion = "2020-06-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("diskName", diskName); + 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/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + 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; + } + + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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"); + } + string apiVersion = "2020-06-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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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/disks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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; + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-06-30"; + // 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, "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/disks").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; + } + + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, diskName, grantAccessData, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, diskName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, 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 (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (disk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "disk"); + } + if (disk != null) + { + disk.Validate(); + } + string apiVersion = "2020-06-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("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("disk", disk); + 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/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + 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(disk != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(disk, 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; + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, 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 (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (disk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "disk"); + } + string apiVersion = "2020-06-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("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("disk", disk); + 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/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + 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(disk != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(disk, 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; + } + + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// 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 diskName, 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 (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + string apiVersion = "2020-06-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("diskName", diskName); + 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/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + 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; + } + + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access 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> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, 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 (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (grantAccessData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "grantAccessData"); + } + if (grantAccessData != null) + { + grantAccessData.Validate(); + } + string apiVersion = "2020-06-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("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("grantAccessData", grantAccessData); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGrantAccess", 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/disks/{diskName}/beginGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + 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(grantAccessData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(grantAccessData, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// 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 BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, 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 (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + string apiVersion = "2020-06-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("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevokeAccess", 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/disks/{diskName}/endGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + 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; + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperationsExtensions.cs new file mode 100644 index 0000000000000..706d976adba8a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperationsExtensions.cs @@ -0,0 +1,663 @@ +// +// 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 DisksOperations. + /// + public static partial class DisksOperationsExtensions + { + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + public static Disk CreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + public static Disk Update(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk) + { + return operations.UpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + public static Disk Get(this IDisksOperations operations, string resourceGroupName, string diskName) + { + return operations.GetAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + public static void Delete(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.DeleteAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDisksOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDisksOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDisksOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDisksOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri GrantAccess(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData) + { + return operations.GrantAccessAsync(resourceGroupName, diskName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task GrantAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GrantAccessWithHttpMessagesAsync(resourceGroupName, diskName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + public static void RevokeAccess(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.RevokeAccessAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task RevokeAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RevokeAccessWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + public static Disk BeginUpdate(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk) + { + return operations.BeginUpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + public static void BeginDelete(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.BeginDeleteAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri BeginGrantAccess(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData) + { + return operations.BeginGrantAccessAsync(resourceGroupName, diskName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginGrantAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, diskName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + public static void BeginRevokeAccess(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.BeginRevokeAccessAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevokeAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDisksOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDisksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDisksOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// 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 IDisksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs new file mode 100644 index 0000000000000..cd1041750010d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs @@ -0,0 +1,1673 @@ +// +// 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; + + /// + /// GalleriesOperations operations. + /// + internal partial class GalleriesOperations : IServiceOperations, IGalleriesOperations + { + /// + /// Initializes a new instance of the GalleriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleriesOperations(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 Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// 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. + /// + /// + /// 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 galleryName, string select = default(string), 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"); + } + 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("select", select); + 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/galleries/{galleryName}").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 (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + 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; + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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"); + } + 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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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 galleries under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + 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("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}/providers/Microsoft.Compute/galleries").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; + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, 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 (gallery == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gallery"); + } + if (gallery != null) + { + gallery.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("gallery", gallery); + 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/galleries/{galleryName}").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("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(gallery != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(gallery, 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 && (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 == 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); + } + } + // 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; + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, 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 (gallery == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gallery"); + } + 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("gallery", gallery); + 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}").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("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(gallery != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(gallery, 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; + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// 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 galleryName, 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"); + } + 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("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/galleries/{galleryName}").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("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; + } + + /// + /// List galleries under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// List galleries under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs new file mode 100644 index 0000000000000..d5c55ace52ecd --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs @@ -0,0 +1,477 @@ +// +// 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 GalleriesOperations. + /// + public static partial class GalleriesOperationsExtensions + { + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + public static Gallery CreateOrUpdate(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + public static Gallery Update(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery) + { + return operations.UpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// 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, select).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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, string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, select, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + public static void Delete(this IGalleriesOperations operations, string resourceGroupName, string galleryName) + { + operations.DeleteAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IGalleriesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IGalleriesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List galleries under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IGalleriesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List galleries under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IGalleriesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + public static Gallery BeginCreateOrUpdate(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + public static Gallery BeginUpdate(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + public static void BeginDelete(this IGalleriesOperations operations, string resourceGroupName, string galleryName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IGalleriesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IGalleriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List galleries under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IGalleriesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List galleries under a subscription. + /// + /// + /// 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 IGalleriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperations.cs new file mode 100644 index 0000000000000..7fee20b39f3ce --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperations.cs @@ -0,0 +1,1454 @@ +// +// 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; + + /// + /// GalleryApplicationVersionsOperations operations. + /// + internal partial class GalleryApplicationVersionsOperations : IServiceOperations, IGalleryApplicationVersionsOperations + { + /// + /// Initializes a new instance of the GalleryApplicationVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryApplicationVersionsOperations(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 gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application Version + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// 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 galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string), 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + 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("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + tracingParameters.Add("expand", expand); + 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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; + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition from + /// which the Application 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>> ListByGalleryApplicationWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + 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("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryApplication", 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}/applications/{galleryApplicationName}/versions").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + 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; + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application Version + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + if (galleryApplicationVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersion"); + } + if (galleryApplicationVersion != null) + { + galleryApplicationVersion.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("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplicationVersion", galleryApplicationVersion); + 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + 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(galleryApplicationVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplicationVersion, 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 && (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 == 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); + } + } + // 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; + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + if (galleryApplicationVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersion"); + } + 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("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplicationVersion", galleryApplicationVersion); + 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}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + 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(galleryApplicationVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplicationVersion, 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; + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// 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 galleryName, string galleryApplicationName, string galleryApplicationVersionName, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + 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("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + 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; + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// 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>> ListByGalleryApplicationNextWithHttpMessagesAsync(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, "ListByGalleryApplicationNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperationsExtensions.cs new file mode 100644 index 0000000000000..cc5e317d0b6cb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationVersionsOperationsExtensions.cs @@ -0,0 +1,555 @@ +// +// 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 GalleryApplicationVersionsOperations. + /// + public static partial class GalleryApplicationVersionsOperationsExtensions + { + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application Version + /// operation. + /// + public static GalleryApplicationVersion CreateOrUpdate(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application Version + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version operation. + /// + public static GalleryApplicationVersion Update(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + public static GalleryApplicationVersion Get(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + public static void Delete(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition from + /// which the Application Versions are to be listed. + /// + public static IPage ListByGalleryApplication(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + return operations.ListByGalleryApplicationAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition from + /// which the Application Versions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryApplicationAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryApplicationWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application Version + /// operation. + /// + public static GalleryApplicationVersion BeginCreateOrUpdate(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application Version + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version operation. + /// + public static GalleryApplicationVersion BeginUpdate(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + public static void BeginDelete(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryApplicationNext(this IGalleryApplicationVersionsOperations operations, string nextPageLink) + { + return operations.ListByGalleryApplicationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryApplicationNextAsync(this IGalleryApplicationVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryApplicationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperations.cs new file mode 100644 index 0000000000000..ee8bf60a5e4ef --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperations.cs @@ -0,0 +1,1377 @@ +// +// 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; + + /// + /// GalleryApplicationsOperations operations. + /// + internal partial class GalleryApplicationsOperations : IServiceOperations, IGalleryApplicationsOperations + { + /// + /// Initializes a new instance of the GalleryApplicationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryApplicationsOperations(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 gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the Application + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + /// + /// 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 galleryName, string galleryApplicationName, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + 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("galleryApplicationName", galleryApplicationName); + 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/galleries/{galleryName}/applications/{galleryApplicationName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + 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; + } + + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions 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>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, 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"); + } + 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGallery", 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}/applications").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("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; + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplication == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplication"); + } + if (galleryApplication != null) + { + galleryApplication.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("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplication", galleryApplication); + 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/galleries/{galleryName}/applications/{galleryApplicationName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + 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(galleryApplication != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplication, 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 && (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 == 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); + } + } + // 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; + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplication == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplication"); + } + 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("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplication", galleryApplication); + 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}/applications/{galleryApplicationName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + 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(galleryApplication != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplication, 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; + } + + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// 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 galleryName, string galleryApplicationName, 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 (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + 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("galleryApplicationName", galleryApplicationName); + 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/galleries/{galleryName}/applications/{galleryApplicationName}").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)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + 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; + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// 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>> ListByGalleryNextWithHttpMessagesAsync(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, "ListByGalleryNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperationsExtensions.cs new file mode 100644 index 0000000000000..c921093fd3063 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryApplicationsOperationsExtensions.cs @@ -0,0 +1,471 @@ +// +// 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 GalleryApplicationsOperations. + /// + public static partial class GalleryApplicationsOperationsExtensions + { + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + public static GalleryApplication CreateOrUpdate(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + public static GalleryApplication Update(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the Application + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + public static GalleryApplication Get(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the Application + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + public static void Delete(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions are to be listed. + /// + public static IPage ListByGallery(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName) + { + return operations.ListByGalleryAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + public static GalleryApplication BeginCreateOrUpdate(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + public static GalleryApplication BeginUpdate(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + public static void BeginDelete(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryNext(this IGalleryApplicationsOperations operations, string nextPageLink) + { + return operations.ListByGalleryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryNextAsync(this IGalleryApplicationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperations.cs new file mode 100644 index 0000000000000..112a66063ee3b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperations.cs @@ -0,0 +1,1446 @@ +// +// 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; + + /// + /// GalleryImageVersionsOperations operations. + /// + internal partial class GalleryImageVersionsOperations : IServiceOperations, IGalleryImageVersionsOperations + { + /// + /// Initializes a new instance of the GalleryImageVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryImageVersionsOperations(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 gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be created. + /// + /// + /// 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 + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be updated. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// 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 galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string), 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 (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("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("expand", expand); + 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").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)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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; + } + + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the Shared Image 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>> ListByGalleryImageWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, 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 (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("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryImage", 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}/images/{galleryImageName}/versions").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)); + _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; + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be created. + /// + /// + /// 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 + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, 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 (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + if (galleryImageVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersion"); + } + if (galleryImageVersion != null) + { + galleryImageVersion.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("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImageVersion", galleryImageVersion); + 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").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)); + _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("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(galleryImageVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImageVersion, 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 && (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 == 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); + } + } + // 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; + } + + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be updated. + /// + /// + /// 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. + /// + /// + /// 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, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, 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 (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + if (galleryImageVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersion"); + } + 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("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImageVersion", galleryImageVersion); + 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}/images/{galleryImageName}/versions/{galleryImageVersionName}").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)); + _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("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(galleryImageVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImageVersion, 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; + } + + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// 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 galleryName, string galleryImageName, string galleryImageVersionName, 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 (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("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").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)); + _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("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; + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// 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>> ListByGalleryImageNextWithHttpMessagesAsync(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, "ListByGalleryImageNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperationsExtensions.cs new file mode 100644 index 0000000000000..f77ed912503e0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImageVersionsOperationsExtensions.cs @@ -0,0 +1,539 @@ +// +// 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 GalleryImageVersionsOperations. + /// + public static partial class GalleryImageVersionsOperationsExtensions + { + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be created. + /// + /// + /// 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 + /// operation. + /// + public static GalleryImageVersion CreateOrUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be created. + /// + /// + /// 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 + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be updated. + /// + /// + /// 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. + /// + public static GalleryImageVersion Update(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be updated. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + public static GalleryImageVersion Get(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// 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) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the Shared Image Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + public static IPage ListByGalleryImage(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName) + { + return operations.ListByGalleryImageAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the Shared Image Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryImageAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryImageWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be created. + /// + /// + /// 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 + /// operation. + /// + public static GalleryImageVersion BeginCreateOrUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be created. + /// + /// + /// 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 + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be updated. + /// + /// + /// 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. + /// + public static GalleryImageVersion BeginUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// be updated. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// 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) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryImageNext(this IGalleryImageVersionsOperations operations, string nextPageLink) + { + return operations.ListByGalleryImageNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryImageNextAsync(this IGalleryImageVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryImageNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperations.cs new file mode 100644 index 0000000000000..02f11b8fd7aca --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperations.cs @@ -0,0 +1,1377 @@ +// +// 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; + + /// + /// GalleryImagesOperations operations. + /// + internal partial class GalleryImagesOperations : IServiceOperations, IGalleryImagesOperations + { + /// + /// Initializes a new instance of the GalleryImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryImagesOperations(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 gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image Definitions are + /// to be retrieved. + /// + /// + /// The name of the gallery image definition to be retrieved. + /// + /// + /// 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 galleryName, string galleryImageName, 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 (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("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + 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/galleries/{galleryName}/images/{galleryImageName}").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)); + _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; + } + + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions 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>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, 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"); + } + 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGallery", 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}/images").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("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; + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, 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 (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImage"); + } + if (galleryImage != null) + { + galleryImage.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("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImage", galleryImage); + 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/galleries/{galleryName}/images/{galleryImageName}").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)); + _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("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(galleryImage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImage, 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 && (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 == 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); + } + } + // 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; + } + + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, 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 (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImage"); + } + 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("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImage", galleryImage); + 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}/images/{galleryImageName}").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)); + _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("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(galleryImage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImage, 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; + } + + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// 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 galleryName, string galleryImageName, 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 (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("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + 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/galleries/{galleryName}/images/{galleryImageName}").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)); + _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("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; + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// 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>> ListByGalleryNextWithHttpMessagesAsync(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, "ListByGalleryNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperationsExtensions.cs new file mode 100644 index 0000000000000..578c096bffa62 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleryImagesOperationsExtensions.cs @@ -0,0 +1,471 @@ +// +// 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 GalleryImagesOperations. + /// + public static partial class GalleryImagesOperationsExtensions + { + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + public static GalleryImage CreateOrUpdate(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + public static GalleryImage Update(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image Definitions are + /// 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) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image Definitions are + /// to be retrieved. + /// + /// + /// The name of the gallery image definition to be retrieved. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is 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) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions are to be + /// listed. + /// + public static IPage ListByGallery(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName) + { + return operations.ListByGalleryAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions are to be + /// listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + public static GalleryImage BeginCreateOrUpdate(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + public static GalleryImage BeginUpdate(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is 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) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryNext(this IGalleryImagesOperations operations, string nextPageLink) + { + return operations.ListByGalleryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryNextAsync(this IGalleryImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperations.cs new file mode 100644 index 0000000000000..36d20e5f894bf --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/GallerySharingProfileOperationsExtensions.cs new file mode 100644 index 0000000000000..9ab1747dd2367 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/IAvailabilitySetsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IAvailabilitySetsOperations.cs new file mode 100644 index 0000000000000..e24829ecadaf8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IAvailabilitySetsOperations.cs @@ -0,0 +1,245 @@ +// +// 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; + + /// + /// AvailabilitySetsOperations operations. + /// + public partial interface IAvailabilitySetsOperations + { + /// + /// Create or update an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// 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 availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// 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 availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// '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>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The 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)); + /// + /// Lists all available virtual machine sizes that can be used to + /// create a new virtual machine in an existing availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// 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>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a subscription. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a resource group. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs new file mode 100644 index 0000000000000..5035b28856592 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs @@ -0,0 +1,250 @@ +// +// 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; + + /// + /// Compute Client + /// + public partial interface IComputeManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// Subscription credentials which uniquely identify Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every + /// service call. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IAvailabilitySetsOperations. + /// + IAvailabilitySetsOperations AvailabilitySets { get; } + + /// + /// Gets the IProximityPlacementGroupsOperations. + /// + IProximityPlacementGroupsOperations ProximityPlacementGroups { get; } + + /// + /// Gets the IDedicatedHostGroupsOperations. + /// + IDedicatedHostGroupsOperations DedicatedHostGroups { get; } + + /// + /// Gets the IDedicatedHostsOperations. + /// + IDedicatedHostsOperations DedicatedHosts { get; } + + /// + /// Gets the ISshPublicKeysOperations. + /// + ISshPublicKeysOperations SshPublicKeys { get; } + + /// + /// Gets the IVirtualMachineExtensionImagesOperations. + /// + IVirtualMachineExtensionImagesOperations VirtualMachineExtensionImages { get; } + + /// + /// Gets the IVirtualMachineExtensionsOperations. + /// + IVirtualMachineExtensionsOperations VirtualMachineExtensions { get; } + + /// + /// Gets the IVirtualMachineImagesOperations. + /// + IVirtualMachineImagesOperations VirtualMachineImages { get; } + + /// + /// Gets the IVirtualMachineImagesEdgeZoneOperations. + /// + IVirtualMachineImagesEdgeZoneOperations VirtualMachineImagesEdgeZone { get; } + + /// + /// Gets the IUsageOperations. + /// + IUsageOperations Usage { get; } + + /// + /// Gets the IVirtualMachinesOperations. + /// + IVirtualMachinesOperations VirtualMachines { get; } + + /// + /// Gets the IVirtualMachineScaleSetsOperations. + /// + IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; } + + /// + /// Gets the IVirtualMachineSizesOperations. + /// + IVirtualMachineSizesOperations VirtualMachineSizes { get; } + + /// + /// Gets the IImagesOperations. + /// + IImagesOperations Images { get; } + + /// + /// Gets the IVirtualMachineScaleSetExtensionsOperations. + /// + IVirtualMachineScaleSetExtensionsOperations VirtualMachineScaleSetExtensions { get; } + + /// + /// Gets the IVirtualMachineScaleSetRollingUpgradesOperations. + /// + IVirtualMachineScaleSetRollingUpgradesOperations VirtualMachineScaleSetRollingUpgrades { get; } + + /// + /// Gets the IVirtualMachineScaleSetVMExtensionsOperations. + /// + IVirtualMachineScaleSetVMExtensionsOperations VirtualMachineScaleSetVMExtensions { get; } + + /// + /// Gets the IVirtualMachineScaleSetVMsOperations. + /// + IVirtualMachineScaleSetVMsOperations VirtualMachineScaleSetVMs { get; } + + /// + /// Gets the ILogAnalyticsOperations. + /// + ILogAnalyticsOperations LogAnalytics { get; } + + /// + /// Gets the IVirtualMachineRunCommandsOperations. + /// + IVirtualMachineRunCommandsOperations VirtualMachineRunCommands { get; } + + /// + /// Gets the IResourceSkusOperations. + /// + IResourceSkusOperations ResourceSkus { get; } + + /// + /// Gets the IDisksOperations. + /// + IDisksOperations Disks { get; } + + /// + /// Gets the ISnapshotsOperations. + /// + ISnapshotsOperations Snapshots { get; } + + /// + /// Gets the IDiskEncryptionSetsOperations. + /// + IDiskEncryptionSetsOperations DiskEncryptionSets { get; } + + /// + /// Gets the IDiskAccessesOperations. + /// + IDiskAccessesOperations DiskAccesses { get; } + + /// + /// Gets the IGalleriesOperations. + /// + IGalleriesOperations Galleries { get; } + + /// + /// Gets the IGalleryImagesOperations. + /// + IGalleryImagesOperations GalleryImages { get; } + + /// + /// Gets the IGalleryImageVersionsOperations. + /// + IGalleryImageVersionsOperations GalleryImageVersions { get; } + + /// + /// Gets the IGalleryApplicationsOperations. + /// + IGalleryApplicationsOperations GalleryApplications { get; } + + /// + /// Gets the IGalleryApplicationVersionsOperations. + /// + 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; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IContainerServicesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IContainerServicesOperations.cs new file mode 100644 index 0000000000000..d8293bc2d92d0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IContainerServicesOperations.cs @@ -0,0 +1,298 @@ +// +// 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; + + /// + /// ContainerServicesOperations operations. + /// + public partial interface IContainerServicesOperations + { + /// + /// Gets a list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. + /// The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and + /// FQDNs of masters and agents. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified + /// configuration of orchestrator, masters, and agents. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string containerServiceName, ContainerService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the properties of the specified container service. + /// + /// + /// Gets the properties of the specified container service in the + /// specified subscription and resource group. The operation returns + /// the properties including state, orchestrator, number of masters and + /// agents, and FQDNs of masters and agents. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string containerServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified + /// subscription and resource group. The operation does not delete + /// other resources created as part of creating a container service, + /// including storage accounts, VMs, and availability sets. All the + /// other resources created with the container service are part of the + /// same resource group and can be deleted individually. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// 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 containerServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container + /// service including state, orchestrator, number of masters and + /// agents, and FQDNs of masters and agents. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a container service. + /// + /// + /// Creates or updates a container service with the specified + /// configuration of orchestrator, masters, and agents. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// Parameters supplied to the Create or Update a Container Service + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string containerServiceName, ContainerService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified container service. + /// + /// + /// Deletes the specified container service in the specified + /// subscription and resource group. The operation does not delete + /// other resources created as part of creating a container service, + /// including storage accounts, VMs, and availability sets. All the + /// other resources created with the container service are part of the + /// same resource group and can be deleted individually. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the container service in the specified subscription and + /// resource group. + /// + /// + /// 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 containerServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of container services in the specified subscription. + /// + /// + /// Gets a list of container services in the specified subscription. + /// The operation returns properties of each container service + /// including state, orchestrator, number of masters and agents, and + /// FQDNs of masters and agents. + /// + /// + /// 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)); + /// + /// Gets a list of container services in the specified resource group. + /// + /// + /// Gets a list of container services in the specified subscription and + /// resource group. The operation returns properties of each container + /// service including state, orchestrator, number of masters and + /// agents, and FQDNs of masters and agents. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IDedicatedHostGroupsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDedicatedHostGroupsOperations.cs new file mode 100644 index 0000000000000..85ad8f1a3d6fd --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDedicatedHostGroupsOperations.cs @@ -0,0 +1,230 @@ +// +// 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; + + /// + /// DedicatedHostGroupsOperations operations. + /// + public partial interface IDedicatedHostGroupsOperations + { + /// + /// Create or update a dedicated host group. For details of Dedicated + /// Host and Dedicated Host Groups please see [Dedicated Host + /// Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// 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 hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. The response shows + /// the list of instance view of the dedicated hosts under the + /// dedicated host group. 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 resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the specified resource + /// group. Use the nextLink property in the response to get the next + /// page of dedicated host groups. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the specified resource + /// group. Use the nextLink property in the response to get the next + /// page of dedicated host groups. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IDedicatedHostsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDedicatedHostsOperations.cs new file mode 100644 index 0000000000000..abee8ad931350 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDedicatedHostsOperations.cs @@ -0,0 +1,284 @@ +// +// 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; + + /// + /// DedicatedHostsOperations operations. + /// + public partial interface IDedicatedHostsOperations + { + /// + /// Create or update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// 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 hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// 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 hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on 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 resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated hosts in the specified dedicated host + /// group. Use the nextLink property in the response to get the next + /// page of dedicated hosts. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host 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>> ListByHostGroupWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// 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 hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// 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 hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated hosts in the specified dedicated host + /// group. Use the nextLink property in the response to get the next + /// page of dedicated hosts. + /// + /// + /// 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>> ListByHostGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskAccessesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskAccessesOperations.cs new file mode 100644 index 0000000000000..2a3a06016e2fc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskAccessesOperations.cs @@ -0,0 +1,344 @@ +// +// 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; + + /// + /// DiskAccessesOperations operations. + /// + public partial interface IDiskAccessesOperations + { + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk access object supplied in the body of the Put disk access + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskAccessName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the private link resources possible under disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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> GetPrivateLinkResourcesWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk access object supplied in the body of the Put disk access + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskAccessName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskEncryptionSetsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskEncryptionSetsOperations.cs new file mode 100644 index 0000000000000..305f0a1e92b47 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskEncryptionSetsOperations.cs @@ -0,0 +1,370 @@ +// +// 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; + + /// + /// DiskEncryptionSetsOperations operations. + /// + public partial interface IDiskEncryptionSetsOperations + { + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk + /// encryption set 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all resources that are encrypted with this disk encryption + /// set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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>> ListAssociatedResourcesWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk + /// encryption set 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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 diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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)); + /// + /// Lists all resources that are encrypted with this disk encryption + /// set. + /// + /// + /// 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>> ListAssociatedResourcesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IDisksOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDisksOperations.cs new file mode 100644 index 0000000000000..6ea8988fe8a33 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IDisksOperations.cs @@ -0,0 +1,428 @@ +// +// 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; + + /// + /// DisksOperations operations. + /// + public partial interface IDisksOperations + { + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Put disk 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Patch disk 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get disk access + /// 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> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Put disk 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Patch disk 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get disk access + /// 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> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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 BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleriesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleriesOperations.cs new file mode 100644 index 0000000000000..2e17fe75814ad --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleriesOperations.cs @@ -0,0 +1,307 @@ +// +// 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; + + /// + /// GalleriesOperations operations. + /// + public partial interface IGalleriesOperations + { + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// 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. + /// + /// + /// 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 galleryName, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// 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 galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// 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 galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryApplicationVersionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryApplicationVersionsOperations.cs new file mode 100644 index 0000000000000..60c629add8d38 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryApplicationVersionsOperations.cs @@ -0,0 +1,342 @@ +// +// 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; + + /// + /// GalleryApplicationVersionsOperations operations. + /// + public partial interface IGalleryApplicationVersionsOperations + { + /// + /// Create or update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application + /// Version 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values + /// include: 'ReplicationStatus' + /// + /// + /// 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 galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// 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 galleryName, string galleryApplicationName, string galleryApplicationVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Versions in a gallery Application + /// Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition + /// from which the Application 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>> ListByGalleryApplicationWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be created. + /// + /// + /// The name of the gallery Application 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 Application + /// Version 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be updated. + /// + /// + /// The name of the gallery Application 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 Application Version + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// 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 galleryName, string galleryApplicationName, string galleryApplicationVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Versions in a gallery Application + /// Definition. + /// + /// + /// 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>> ListByGalleryApplicationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryApplicationsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryApplicationsOperations.cs new file mode 100644 index 0000000000000..a606926a96de1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryApplicationsOperations.cs @@ -0,0 +1,296 @@ +// +// 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; + + /// + /// GalleryApplicationsOperations operations. + /// + public partial interface IGalleryApplicationsOperations + { + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the + /// Application Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + /// + /// 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 galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// 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 galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions 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>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the create or update gallery Application + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application 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. + /// + /// + /// Parameters supplied to the update gallery Application 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// 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 galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// 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>> ListByGalleryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImageVersionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImageVersionsOperations.cs new file mode 100644 index 0000000000000..60387a8991fe5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImageVersionsOperations.cs @@ -0,0 +1,338 @@ +// +// 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; + + /// + /// GalleryImageVersionsOperations operations. + /// + public partial interface IGalleryImageVersionsOperations + { + /// + /// Create or update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 be created. + /// + /// + /// 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 + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 be updated. + /// + /// + /// 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. + /// + /// + /// 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, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values + /// include: 'ReplicationStatus' + /// + /// + /// 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 galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// 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 galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the Shared Image 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>> ListByGalleryImageWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 be created. + /// + /// + /// 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 + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 be updated. + /// + /// + /// 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. + /// + /// + /// 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, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// 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 galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// 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>> ListByGalleryImageNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImagesOperations.cs new file mode 100644 index 0000000000000..bfe8aaf91f55c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGalleryImagesOperations.cs @@ -0,0 +1,296 @@ +// +// 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; + + /// + /// GalleryImagesOperations operations. + /// + public partial interface IGalleryImagesOperations + { + /// + /// Create or update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery image definition to be retrieved. + /// + /// + /// 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 galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// 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 galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions + /// 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>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be created. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the create or update gallery image + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be updated. + /// + /// + /// 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. + /// + /// + /// Parameters supplied to the update gallery image 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// 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 galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image definitions in a gallery. + /// + /// + /// 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>> ListByGalleryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IGallerySharingProfileOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IGallerySharingProfileOperations.cs new file mode 100644 index 0000000000000..851857bc297a9 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/IImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IImagesOperations.cs new file mode 100644 index 0000000000000..5518972fbce34 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IImagesOperations.cs @@ -0,0 +1,300 @@ +// +// 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; + + /// + /// ImagesOperations operations. + /// + public partial interface IImagesOperations + { + /// + /// Create or update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// 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 imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string imageName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of images under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of Images in the subscription. Use nextLink property + /// in the response to get the next page of Images. Do this till + /// nextLink is null to fetch all the Images. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// 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 imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of images under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of Images in the subscription. Use nextLink property + /// in the response to get the next page of Images. Do this till + /// nextLink is null to fetch all the Images. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/ILogAnalyticsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ILogAnalyticsOperations.cs new file mode 100644 index 0000000000000..ab57fceb0ef6a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ILogAnalyticsOperations.cs @@ -0,0 +1,133 @@ +// +// 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; + + /// + /// LogAnalyticsOperations operations. + /// + public partial interface ILogAnalyticsOperations + { + /// + /// Export logs that show Api requests made by this subscription in the + /// given time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval + /// Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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> ExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export logs that show total throttled Api requests for this + /// subscription in the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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> ExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export logs that show Api requests made by this subscription in the + /// given time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval + /// Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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> BeginExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export logs that show total throttled Api requests for this + /// subscription in the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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> BeginExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..864deb05d8fcf --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IOperations.cs @@ -0,0 +1,46 @@ +// +// 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; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Gets a list of compute operations. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IProximityPlacementGroupsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IProximityPlacementGroupsOperations.cs new file mode 100644 index 0000000000000..e32a4edba1dbf --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IProximityPlacementGroupsOperations.cs @@ -0,0 +1,220 @@ +// +// 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; + + /// + /// ProximityPlacementGroupsOperations operations. + /// + public partial interface IProximityPlacementGroupsOperations + { + /// + /// Create or update a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// 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 proximityPlacementGroupName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// 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 proximityPlacementGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status + /// of all the resources in the proximity placement 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> GetWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IResourceSkusOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IResourceSkusOperations.cs new file mode 100644 index 0000000000000..9c6c2d0d69852 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IResourceSkusOperations.cs @@ -0,0 +1,74 @@ +// +// 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; + + /// + /// ResourceSkusOperations operations. + /// + public partial interface IResourceSkusOperations + { + /// + /// Gets the list of Microsoft.Compute SKUs available for your + /// Subscription. + /// + /// + /// The filter to apply on the operation. Only **location** filter is + /// supported currently. + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of Microsoft.Compute SKUs available for your + /// Subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleriesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleriesOperations.cs new file mode 100644 index 0000000000000..369d638e16b09 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImageVersionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImageVersionsOperations.cs new file mode 100644 index 0000000000000..f885944fb8f4a --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ISharedGalleryImagesOperations.cs new file mode 100644 index 0000000000000..29684dfca5e75 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/ISnapshotsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ISnapshotsOperations.cs new file mode 100644 index 0000000000000..88dc215c00e19 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ISnapshotsOperations.cs @@ -0,0 +1,419 @@ +// +// 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; + + /// + /// SnapshotsOperations operations. + /// + public partial interface ISnapshotsOperations + { + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// 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> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// 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> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/ISshPublicKeysOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ISshPublicKeysOperations.cs new file mode 100644 index 0000000000000..9b4190bfc6021 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ISshPublicKeysOperations.cs @@ -0,0 +1,251 @@ +// +// 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; + + /// + /// SshPublicKeysOperations operations. + /// + public partial interface ISshPublicKeysOperations + { + /// + /// Lists all of the SSH public keys in the subscription. Use the + /// nextLink property in the response to get the next page of SSH + /// public keys. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the SSH public keys in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// SSH public keys. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + /// + /// 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 sshPublicKeyName, SshPublicKeyUpdateResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// 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 sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// 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 sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Generates and returns a public/private key pair and populates the + /// SSH public key resource with the public key. The length of the key + /// will be 3072 bits. This operation can only be performed once per + /// SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// 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> GenerateKeyPairWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the SSH public keys in the subscription. Use the + /// nextLink property in the response to get the next page of SSH + /// public keys. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the SSH public keys in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// SSH public keys. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IUsageOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IUsageOperations.cs new file mode 100644 index 0000000000000..85f01597fb859 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IUsageOperations.cs @@ -0,0 +1,75 @@ +// +// 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; + + /// + /// UsageOperations operations. + /// + public partial interface IUsageOperations + { + /// + /// Gets, for the specified location, the current compute resource + /// usage information as well as the limits for compute resources under + /// the subscription. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets, for the specified location, the current compute resource + /// usage information as well as the limits for compute resources under + /// the subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineExtensionImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineExtensionImagesOperations.cs new file mode 100644 index 0000000000000..f3bf0652823e0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineExtensionImagesOperations.cs @@ -0,0 +1,109 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineExtensionImagesOperations operations. + /// + public partial interface IVirtualMachineExtensionImagesOperations + { + /// + /// Gets a virtual machine extension image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + /// + /// 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 publisherName, string type, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine extension image types. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// 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>> ListTypesWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine extension image versions. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the 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>> ListVersionsWithHttpMessagesAsync(string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineExtensionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineExtensionsOperations.cs new file mode 100644 index 0000000000000..174428de75386 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineExtensionsOperations.cs @@ -0,0 +1,270 @@ +// +// 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; + + /// + /// VirtualMachineExtensionsOperations operations. + /// + public partial interface IVirtualMachineExtensionsOperations + { + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// created or updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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 vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the 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> ListWithHttpMessagesAsync(string resourceGroupName, string vmName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// created or updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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 vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesEdgeZoneOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesEdgeZoneOperations.cs new file mode 100644 index 0000000000000..3beead36a4a6e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesEdgeZoneOperations.cs @@ -0,0 +1,197 @@ +// +// 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; + + /// + /// VirtualMachineImagesEdgeZoneOperations operations. + /// + public partial interface IVirtualMachineImagesEdgeZoneOperations + { + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that + /// matches supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData + /// query. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image offers for the specified + /// location, edge zone and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// 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>> ListOffersWithHttpMessagesAsync(string location, string edgeZone, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image publishers for the specified + /// Azure location and edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// 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>> ListPublishersWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image SKUs for the specified + /// location, edge zone, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesOperations.cs new file mode 100644 index 0000000000000..4a21b2eedbbd0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesOperations.cs @@ -0,0 +1,178 @@ +// +// 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; + + /// + /// VirtualMachineImagesOperations operations. + /// + public partial interface IVirtualMachineImagesOperations + { + /// + /// Gets a virtual machine image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// 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 publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the 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>> ListWithHttpMessagesAsync(string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image offers for the specified + /// location and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// 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>> ListOffersWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image publishers for the specified + /// Azure location. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// 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>> ListPublishersWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image SKUs for the specified + /// location, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string location, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineRunCommandsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineRunCommandsOperations.cs new file mode 100644 index 0000000000000..cedeeaf1e4328 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineRunCommandsOperations.cs @@ -0,0 +1,96 @@ +// +// 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; + + /// + /// VirtualMachineRunCommandsOperations operations. + /// + public partial interface IVirtualMachineRunCommandsOperations + { + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + /// + /// 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 commandId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetExtensionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetExtensionsOperations.cs new file mode 100644 index 0000000000000..d07dad068a72f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetExtensionsOperations.cs @@ -0,0 +1,281 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetExtensionsOperations operations. + /// + public partial interface IVirtualMachineScaleSetExtensionsOperations + { + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// 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 vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// 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 vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// 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 vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetRollingUpgradesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetRollingUpgradesOperations.cs new file mode 100644 index 0000000000000..b866585a44dd0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetRollingUpgradesOperations.cs @@ -0,0 +1,197 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetRollingUpgradesOperations operations. + /// + public partial interface IVirtualMachineScaleSetRollingUpgradesOperations + { + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a rolling upgrade to move all virtual machine scale set + /// instances to the latest available Platform Image OS version. + /// Instances which are already running the latest available OS version + /// are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 StartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a rolling upgrade to move all extensions for all virtual + /// machine scale set instances to the latest available extension + /// version. Instances which are already running the latest extension + /// versions are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 StartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of the latest virtual machine scale set rolling + /// upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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> GetLatestWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 BeginCancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a rolling upgrade to move all virtual machine scale set + /// instances to the latest available Platform Image OS version. + /// Instances which are already running the latest available OS version + /// are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 BeginStartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a rolling upgrade to move all extensions for all virtual + /// machine scale set instances to the latest available extension + /// version. Instances which are already running the latest extension + /// versions are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 BeginStartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs new file mode 100644 index 0000000000000..6aaf30ab54380 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs @@ -0,0 +1,289 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetVMExtensionsOperations operations. + /// + public partial interface IVirtualMachineScaleSetVMExtensionsOperations + { + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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 vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the 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> 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the 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> 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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 vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs new file mode 100644 index 0000000000000..7d01ea2808edb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs @@ -0,0 +1,829 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMsOperations operations. + /// + public partial interface IVirtualMachineScaleSetVMsOperations + { + /// + /// Reimages (upgrade the operating system) a specific virtual machine + /// in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: + /// This temp disk reimage parameter is only supported for VM/VMSS with + /// Ephemeral OS disk. + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Allows you to re-image all the disks ( including data disks ) in + /// the a VM scale set instance. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts + /// down the virtual machine and releases the compute resources it + /// uses. You are not billed for the compute resources of this virtual + /// machine once it is deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM + /// scale set. (Feature in Preview) + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on 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 resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + /// + /// 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 virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that + /// resources are still attached and you are getting charged for the + /// resources. Instead, use deallocate to release resources and avoid + /// charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine in the virtual machine scale set, + /// moves it to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a + /// virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value + /// between 1 to 1440 minutes. <br><br>NOTE: If not + /// specified, SAS URIs will be generated with a default expiration + /// duration of 120 minutes. + /// + /// + /// 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> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to simulate the eviction of spot virtual machine in a + /// VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command 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> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) a specific virtual machine + /// in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: + /// This temp disk reimage parameter is only supported for VM/VMSS with + /// Ephemeral OS disk. + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Allows you to re-image all the disks ( including data disks ) in + /// the a VM scale set instance. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts + /// down the virtual machine and releases the compute resources it + /// uses. You are not billed for the compute resources of this virtual + /// machine once it is deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM + /// scale set. (Feature in Preview) + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that + /// resources are still attached and you are getting charged for the + /// resources. Instead, use deallocate to release resources and avoid + /// charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine in the virtual machine scale set, + /// moves it to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command 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> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs new file mode 100644 index 0000000000000..6af7aab40f00f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs @@ -0,0 +1,1165 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetsOperations operations. + /// + public partial interface IVirtualMachineScaleSetsOperations + { + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The location for which VM scale sets under the subscription are + /// queried. + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set 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 vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in + /// Preview) + /// + /// + /// 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 vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down + /// the virtual machines and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine + /// scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM + /// scale set. (Feature in Preview) + /// + /// + /// 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 vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The 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)); + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of + /// the associated resource group. Use nextLink property in the + /// response to get the next page of VM Scale Sets. Do this till + /// nextLink is null to fetch all the VM Scale Sets. + /// + /// + /// 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 SKUs available for your VM scale set, including the + /// minimum and maximum VM instances allowed for each SKU. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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>> GetOSUpgradeHistoryWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) one or more virtual machines in a VM scale set. + /// Note that resources are still attached and you are getting charged + /// for the resources. Instead, use deallocate to release resources and + /// avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down all the virtual machines in the virtual machine scale + /// set, moves them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Perform maintenance on one or more virtual machines in a VM scale + /// set. Operation on instances which are not eligible for perform + /// maintenance will be failed. Please refer to best practices for more + /// details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Upgrades one or more virtual machines to the latest SKU set in the + /// VM scale set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// 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 UpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) one or more virtual + /// machines in a VM scale set which don't have a ephemeral OS disk, + /// for virtual machines who have a ephemeral OS disk the virtual + /// machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// 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 vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages all the disks ( including data disks ) in the virtual + /// machines in a VM scale set. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Manual platform update domain walk to update virtual machines in a + /// service fabric virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is + /// requested + /// + /// + /// 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> ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Converts SinglePlacementGroup property to false for a existing + /// virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use + /// Virtual Machine Scale Set VMs - Get API. If not provided, the + /// platform will choose one with maximum number of virtual machine + /// instances. + /// + /// + /// 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 ConvertToSinglePlacementGroupWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// 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 SetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set 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 vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in + /// Preview) + /// + /// + /// 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 vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down + /// the virtual machines and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine + /// scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM + /// scale set. (Feature in Preview) + /// + /// + /// 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 vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) one or more virtual machines in a VM scale set. + /// Note that resources are still attached and you are getting charged + /// for the resources. Instead, use deallocate to release resources and + /// avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down all the virtual machines in the virtual machine scale + /// set, moves them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Perform maintenance on one or more virtual machines in a VM scale + /// set. Operation on instances which are not eligible for perform + /// maintenance will be failed. Please refer to best practices for more + /// details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Upgrades one or more virtual machines to the latest SKU set in the + /// VM scale set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// 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 BeginUpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) one or more virtual + /// machines in a VM scale set which don't have a ephemeral OS disk, + /// for virtual machines who have a ephemeral OS disk the virtual + /// machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// 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 vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages all the disks ( including data disks ) in the virtual + /// machines in a VM scale set. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual + /// machine scale set instance ids will result in the operation being + /// performed on all virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// 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 BeginSetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// 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)); + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of + /// the associated resource group. Use nextLink property in the + /// response to get the next page of VM Scale Sets. Do this till + /// nextLink is null to fetch all the VM Scale Sets. + /// + /// + /// 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 SKUs available for your VM scale set, including the + /// minimum and maximum VM instances allowed for each SKU. + /// + /// + /// 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>> ListSkusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// 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>> GetOSUpgradeHistoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineSizesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineSizesOperations.cs new file mode 100644 index 0000000000000..6e1071152ff3b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineSizesOperations.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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineSizesOperations operations. + /// + public partial interface IVirtualMachineSizesOperations + { + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs new file mode 100644 index 0000000000000..818ce5adb86a0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs @@ -0,0 +1,1154 @@ +// +// 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; + + /// + /// VirtualMachinesOperations operations. + /// + public partial interface IVirtualMachinesOperations + { + /// + /// Gets all the virtual machines under the specified subscription for + /// the specified location. + /// + /// + /// The location for which virtual machines under the subscription are + /// queried. + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs + /// a template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine 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> CaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a virtual machine. Please note + /// some properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in + /// Preview) + /// + /// + /// 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 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on 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 resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about the run-time state of a virtual + /// machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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> InstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmName, 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 + /// operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 ConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine and releases the compute resources. + /// You are not billed for the compute resources that this virtual + /// machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sets the OS state of the virtual machine to generalized. It is + /// recommended to sysprep the virtual machine before performing this + /// operation. <br>For Windows, please refer to [Create a managed + /// image of a generalized VM in + /// Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For + /// Linux, please refer to [How to create an image of a virtual machine + /// or + /// VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 GeneralizeWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the virtual machines in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// The 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)); + /// + /// Lists all of the virtual machines in the specified subscription. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual + /// Machines in the subscription. + /// + /// + /// 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(string statusOnly = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available virtual machine sizes to which the specified + /// virtual machine can be resized. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to power off (stop) a virtual machine. The virtual + /// machine can be restarted with the same provisioned resources. You + /// are still charged for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// 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 vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine, moves it to a new node, and powers + /// it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 RedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to + /// its initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: + /// This temp disk reimage parameter is only supported for VM/VMSS with + /// Ephemeral OS disk. + /// + /// + /// 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 vmName, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot + /// diagnostic logs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value + /// between 1 to 1440 minutes. <br><br>NOTE: If not + /// specified, SAS URIs will be generated with a default expiration + /// duration of 120 minutes. + /// + /// + /// 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> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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> AssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// 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> InstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command 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> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs + /// a template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine 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> BeginCaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a virtual machine. Please note + /// some properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in + /// Preview) + /// + /// + /// 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 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 + /// operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine and releases the compute resources. + /// You are not billed for the compute resources that this virtual + /// machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to power off (stop) a virtual machine. The virtual + /// machine can be restarted with the same provisioned resources. You + /// are still charged for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// 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 vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine, moves it to a new node, and powers + /// it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to + /// its initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: + /// This temp disk reimage parameter is only supported for VM/VMSS with + /// Ephemeral OS disk. + /// + /// + /// 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 vmName, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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> BeginAssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// 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> BeginInstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command 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> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the virtual machines under the specified subscription for + /// the specified location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the virtual machines in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// 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)); + /// + /// Lists all of the virtual machines in the specified subscription. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// 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)); + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs new file mode 100644 index 0000000000000..9ccac6de301c5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs @@ -0,0 +1,1668 @@ +// +// 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; + + /// + /// ImagesOperations operations. + /// + internal partial class ImagesOperations : IServiceOperations, IImagesOperations + { + /// + /// Initializes a new instance of the ImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ImagesOperations(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 an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, imageName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string imageName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + tracingParameters.Add("expand", expand); + 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/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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 images under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(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-12-01"; + // 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, "ListByResourceGroup", 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/images").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; + } + + /// + /// Gets the list of Images in the subscription. Use nextLink property in the + /// response to get the next page of Images. Do this till nextLink is null to + /// fetch all the Images. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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, "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/images").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; + } + + /// + /// Create or update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _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 an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _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 && (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; + } + + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// 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 imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + 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/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _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; + } + + /// + /// Gets the list of images under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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 the list of Images in the subscription. Use nextLink property in the + /// response to get the next page of Images. Do this till nextLink is null to + /// fetch all the Images. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperationsExtensions.cs new file mode 100644 index 0000000000000..896c707cd75c7 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperationsExtensions.cs @@ -0,0 +1,467 @@ +// +// 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 ImagesOperations. + /// + public static partial class ImagesOperationsExtensions + { + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + public static Image CreateOrUpdate(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + public static Image Update(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + public static void Delete(this IImagesOperations operations, string resourceGroupName, string imageName) + { + operations.DeleteAsync(resourceGroupName, imageName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IImagesOperations operations, string resourceGroupName, string imageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, imageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the operation. + /// + public static Image Get(this IImagesOperations operations, string resourceGroupName, string imageName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, imageName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IImagesOperations operations, string resourceGroupName, string imageName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, imageName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of images under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IImagesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of images under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IImagesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of Images in the subscription. Use nextLink property in the + /// response to get the next page of Images. Do this till nextLink is null to + /// fetch all the Images. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IImagesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Images in the subscription. Use nextLink property in the + /// response to get the next page of Images. Do this till nextLink is null to + /// fetch all the Images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IImagesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + public static Image BeginCreateOrUpdate(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + public static Image BeginUpdate(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + public static void BeginDelete(this IImagesOperations operations, string resourceGroupName, string imageName) + { + operations.BeginDeleteAsync(resourceGroupName, imageName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IImagesOperations operations, string resourceGroupName, string imageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, imageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of images under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IImagesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of images under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of Images in the subscription. Use nextLink property in the + /// response to get the next page of Images. Do this till nextLink is null to + /// fetch all the Images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IImagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Images in the subscription. Use nextLink property in the + /// response to get the next page of Images. Do this till nextLink is null to + /// fetch all the Images. + /// + /// + /// 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 IImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs new file mode 100644 index 0000000000000..90df713f2e745 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs @@ -0,0 +1,522 @@ +// +// 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; + + /// + /// LogAnalyticsOperations operations. + /// + internal partial class LogAnalyticsOperations : IServiceOperations, ILogAnalyticsOperations + { + /// + /// Initializes a new instance of the LogAnalyticsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LogAnalyticsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExportRequestRateByIntervalWithHttpMessagesAsync(parameters, location, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExportThrottledRequestsWithHttpMessagesAsync(parameters, location, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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> BeginExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExportRequestRateByInterval", 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}/logAnalytics/apiAccess/getRequestRateByInterval").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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(); + } + // 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; + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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> BeginExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExportThrottledRequests", 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}/logAnalytics/apiAccess/getThrottledRequests").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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(); + } + // 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/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperationsExtensions.cs new file mode 100644 index 0000000000000..de07f1b3d5fde --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperationsExtensions.cs @@ -0,0 +1,193 @@ +// +// 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 LogAnalyticsOperations. + /// + public static partial class LogAnalyticsOperationsExtensions + { + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult ExportRequestRateByInterval(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location) + { + return operations.ExportRequestRateByIntervalAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task ExportRequestRateByIntervalAsync(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExportRequestRateByIntervalWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult ExportThrottledRequests(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location) + { + return operations.ExportThrottledRequestsAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task ExportThrottledRequestsAsync(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExportThrottledRequestsWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult BeginExportRequestRateByInterval(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location) + { + return operations.BeginExportRequestRateByIntervalAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportRequestRateByIntervalAsync(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginExportRequestRateByIntervalWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult BeginExportThrottledRequests(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location) + { + return operations.BeginExportThrottledRequestsAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportThrottledRequestsAsync(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginExportThrottledRequestsWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AccessLevel.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AccessLevel.cs new file mode 100644 index 0000000000000..b23ace763aa64 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AccessLevel.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 AccessLevel. + /// + public static class AccessLevel + { + public const string None = "None"; + public const string Read = "Read"; + public const string Write = "Write"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AccessUri.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AccessUri.cs new file mode 100644 index 0000000000000..3b364f54fce5a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AccessUri.cs @@ -0,0 +1,51 @@ +// +// 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 disk access SAS uri. + /// + public partial class AccessUri + { + /// + /// Initializes a new instance of the AccessUri class. + /// + public AccessUri() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessUri class. + /// + /// A SAS uri for accessing a disk. + public AccessUri(string accessSAS = default(string)) + { + AccessSAS = accessSAS; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a SAS uri for accessing a disk. + /// + [JsonProperty(PropertyName = "accessSAS")] + public string AccessSAS { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AdditionalCapabilities.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AdditionalCapabilities.cs new file mode 100644 index 0000000000000..6444e2641f751 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AdditionalCapabilities.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Enables or disables a capability on the virtual machine or virtual + /// machine scale set. + /// + public partial class AdditionalCapabilities + { + /// + /// Initializes a new instance of the AdditionalCapabilities class. + /// + public AdditionalCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdditionalCapabilities class. + /// + /// The flag that enables or disables a + /// capability to have one or more managed data disks with UltraSSD_LRS + /// storage account type on the VM or VMSS. Managed disks with storage + /// account type UltraSSD_LRS can be added to a virtual machine or + /// virtual machine scale set only if this property is enabled. + public AdditionalCapabilities(bool? ultraSSDEnabled = default(bool?)) + { + UltraSSDEnabled = ultraSSDEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the flag that enables or disables a capability to have + /// one or more managed data disks with UltraSSD_LRS storage account + /// type on the VM or VMSS. Managed disks with storage account type + /// UltraSSD_LRS can be added to a virtual machine or virtual machine + /// scale set only if this property is enabled. + /// + [JsonProperty(PropertyName = "ultraSSDEnabled")] + public bool? UltraSSDEnabled { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AdditionalUnattendContent.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AdditionalUnattendContent.cs new file mode 100644 index 0000000000000..b7aac7275880e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AdditionalUnattendContent.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies additional XML formatted information that can be included in + /// the Unattend.xml file, which is used by Windows Setup. Contents are + /// defined by setting name, component name, and the pass in which the + /// content is applied. + /// + public partial class AdditionalUnattendContent + { + /// + /// Initializes a new instance of the AdditionalUnattendContent class. + /// + public AdditionalUnattendContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdditionalUnattendContent class. + /// + /// The pass name. Currently, the only allowable + /// value is OobeSystem. Possible values include: 'OobeSystem' + /// The component name. Currently, the only + /// allowable value is Microsoft-Windows-Shell-Setup. Possible values + /// include: 'Microsoft-Windows-Shell-Setup' + /// Specifies the name of the setting to + /// which the content applies. Possible values are: FirstLogonCommands + /// and AutoLogon. Possible values include: 'AutoLogon', + /// 'FirstLogonCommands' + /// Specifies the XML formatted content that is + /// added to the unattend.xml file for the specified path and + /// component. The XML must be less than 4KB and must include the root + /// element for the setting or feature that is being inserted. + public AdditionalUnattendContent(PassNames? passName = default(PassNames?), ComponentNames? componentName = default(ComponentNames?), SettingNames? settingName = default(SettingNames?), string content = default(string)) + { + PassName = passName; + ComponentName = componentName; + SettingName = settingName; + Content = content; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the pass name. Currently, the only allowable value is + /// OobeSystem. Possible values include: 'OobeSystem' + /// + [JsonProperty(PropertyName = "passName")] + public PassNames? PassName { get; set; } + + /// + /// Gets or sets the component name. Currently, the only allowable + /// value is Microsoft-Windows-Shell-Setup. Possible values include: + /// 'Microsoft-Windows-Shell-Setup' + /// + [JsonProperty(PropertyName = "componentName")] + public ComponentNames? ComponentName { get; set; } + + /// + /// Gets or sets specifies the name of the setting to which the content + /// applies. Possible values are: FirstLogonCommands and AutoLogon. + /// Possible values include: 'AutoLogon', 'FirstLogonCommands' + /// + [JsonProperty(PropertyName = "settingName")] + public SettingNames? SettingName { get; set; } + + /// + /// Gets or sets specifies the XML formatted content that is added to + /// the unattend.xml file for the specified path and component. The XML + /// must be less than 4KB and must include the root element for the + /// setting or feature that is being inserted. + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AggregatedReplicationState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AggregatedReplicationState.cs new file mode 100644 index 0000000000000..b3a4f61130c9b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AggregatedReplicationState.cs @@ -0,0 +1,24 @@ +// +// 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 AggregatedReplicationState. + /// + public static class AggregatedReplicationState + { + public const string Unknown = "Unknown"; + public const string InProgress = "InProgress"; + public const string Completed = "Completed"; + public const string Failed = "Failed"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiEntityReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiEntityReference.cs new file mode 100644 index 0000000000000..85ecc19c88593 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiEntityReference.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.Linq; + + /// + /// The API entity reference. + /// + public partial class ApiEntityReference + { + /// + /// Initializes a new instance of the ApiEntityReference class. + /// + public ApiEntityReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiEntityReference class. + /// + /// The ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + public ApiEntityReference(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiError.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiError.cs new file mode 100644 index 0000000000000..f29314dc30a09 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiError.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Api error. + /// + public partial class ApiError + { + /// + /// Initializes a new instance of the ApiError class. + /// + public ApiError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiError class. + /// + /// The Api error details + /// The Api inner error + /// The error code. + /// The target of the particular error. + /// The error message. + public ApiError(IList details = default(IList), InnerError innererror = default(InnerError), string code = default(string), string target = default(string), string message = default(string)) + { + Details = details; + Innererror = innererror; + Code = code; + Target = target; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Api error details + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + /// + /// Gets or sets the Api inner error + /// + [JsonProperty(PropertyName = "innererror")] + public InnerError Innererror { get; set; } + + /// + /// Gets or sets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the target of the particular error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiErrorBase.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiErrorBase.cs new file mode 100644 index 0000000000000..11cb3c5701e32 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApiErrorBase.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; + + /// + /// Api error base. + /// + public partial class ApiErrorBase + { + /// + /// Initializes a new instance of the ApiErrorBase class. + /// + public ApiErrorBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiErrorBase class. + /// + /// The error code. + /// The target of the particular error. + /// The error message. + public ApiErrorBase(string code = default(string), string target = default(string), string message = default(string)) + { + Code = code; + Target = target; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the target of the particular error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApplicationProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApplicationProfile.cs new file mode 100644 index 0000000000000..4b7ed0d431cef --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApplicationProfile.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; + + /// + /// Contains the list of gallery applications that should be made available + /// to the VM/VMSS + /// + public partial class ApplicationProfile + { + /// + /// Initializes a new instance of the ApplicationProfile class. + /// + public ApplicationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationProfile class. + /// + /// Specifies the gallery + /// applications that should be made available to the VM/VMSS + public ApplicationProfile(IList galleryApplications = default(IList)) + { + GalleryApplications = galleryApplications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "galleryApplications")] + public IList GalleryApplications { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.cs new file mode 100644 index 0000000000000..ac704d99049b8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.cs @@ -0,0 +1,73 @@ +// +// 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 configuration parameters used for performing automatic OS upgrade. + /// + public partial class AutomaticOSUpgradePolicy + { + /// + /// Initializes a new instance of the AutomaticOSUpgradePolicy class. + /// + public AutomaticOSUpgradePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomaticOSUpgradePolicy class. + /// + /// Indicates whether OS + /// upgrades should automatically be applied to scale set instances in + /// a rolling fashion when a newer version of the OS image becomes + /// available. Default value is false. <br><br> If this is + /// set to true for Windows based scale sets, + /// [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) + /// is automatically set to false and cannot be set to true. + /// Whether OS image rollback + /// feature should be disabled. Default value is false. + public AutomaticOSUpgradePolicy(bool? enableAutomaticOSUpgrade = default(bool?), bool? disableAutomaticRollback = default(bool?)) + { + EnableAutomaticOSUpgrade = enableAutomaticOSUpgrade; + DisableAutomaticRollback = disableAutomaticRollback; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether OS upgrades should automatically be + /// applied to scale set instances in a rolling fashion when a newer + /// version of the OS image becomes available. Default value is false. + /// &lt;br&gt;&lt;br&gt; If this is set to true for + /// Windows based scale sets, + /// [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) + /// is automatically set to false and cannot be set to true. + /// + [JsonProperty(PropertyName = "enableAutomaticOSUpgrade")] + public bool? EnableAutomaticOSUpgrade { get; set; } + + /// + /// Gets or sets whether OS image rollback feature should be disabled. + /// Default value is false. + /// + [JsonProperty(PropertyName = "disableAutomaticRollback")] + public bool? DisableAutomaticRollback { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.cs new file mode 100644 index 0000000000000..2b459e236be1b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.cs @@ -0,0 +1,65 @@ +// +// 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 automatic OS upgrade properties on the image. + /// + public partial class AutomaticOSUpgradeProperties + { + /// + /// Initializes a new instance of the AutomaticOSUpgradeProperties + /// class. + /// + public AutomaticOSUpgradeProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomaticOSUpgradeProperties + /// class. + /// + /// Specifies whether + /// automatic OS upgrade is supported on the image. + public AutomaticOSUpgradeProperties(bool automaticOSUpgradeSupported) + { + AutomaticOSUpgradeSupported = automaticOSUpgradeSupported; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether automatic OS upgrade is supported on + /// the image. + /// + [JsonProperty(PropertyName = "automaticOSUpgradeSupported")] + public bool AutomaticOSUpgradeSupported { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs new file mode 100644 index 0000000000000..bb24e531ad19b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs @@ -0,0 +1,75 @@ +// +// 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; + + /// + /// Specifies the configuration parameters for automatic repairs on the + /// virtual machine scale set. + /// + public partial class AutomaticRepairsPolicy + { + /// + /// Initializes a new instance of the AutomaticRepairsPolicy class. + /// + public AutomaticRepairsPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomaticRepairsPolicy class. + /// + /// Specifies whether automatic repairs should be + /// enabled on the virtual machine scale set. The default value is + /// false. + /// The amount of time for which automatic + /// repairs are suspended due to a state change on VM. The grace time + /// starts after the state change has completed. This helps avoid + /// premature or accidental repairs. The time duration should be + /// specified in ISO 8601 format. The minimum allowed grace period is + /// 30 minutes (PT30M), which is also the default value. The maximum + /// allowed grace period is 90 minutes (PT90M). + public AutomaticRepairsPolicy(bool? enabled = default(bool?), string gracePeriod = default(string)) + { + Enabled = enabled; + GracePeriod = gracePeriod; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether automatic repairs should be enabled + /// on the virtual machine scale set. The default value is false. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the amount of time for which automatic repairs are + /// suspended due to a state change on VM. The grace time starts after + /// the state change has completed. This helps avoid premature or + /// accidental repairs. The time duration should be specified in ISO + /// 8601 format. The minimum allowed grace period is 30 minutes + /// (PT30M), which is also the default value. The maximum allowed grace + /// period is 90 minutes (PT90M). + /// + [JsonProperty(PropertyName = "gracePeriod")] + public string GracePeriod { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySet.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySet.cs new file mode 100644 index 0000000000000..996056f68bb6f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySet.cs @@ -0,0 +1,139 @@ +// +// 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 availability set that the virtual + /// machine should be assigned to. Virtual machines specified in the same + /// availability set are allocated to different nodes to maximize + /// availability. For more information about availability sets, see [Manage + /// the availability of virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// <br><br> For more information on Azure planned maintenance, + /// see [Planned maintenance for virtual machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// <br><br> Currently, a VM can only be added to availability + /// set at creation time. An existing VM cannot be added to an availability + /// set. + /// + [Rest.Serialization.JsonTransformation] + public partial class AvailabilitySet : Resource + { + /// + /// Initializes a new instance of the AvailabilitySet class. + /// + public AvailabilitySet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailabilitySet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Update Domain + /// count. + /// Fault Domain count. + /// A list of references to all virtual + /// machines in the availability set. + /// Specifies information about + /// the proximity placement group that the availability set should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// The resource status information. + /// Sku of the availability set, only name is + /// required to be set. See AvailabilitySetSkuTypes for possible set of + /// values. Use 'Aligned' for virtual machines with managed disks and + /// 'Classic' for virtual machines with unmanaged disks. Default value + /// is 'Classic'. + public AvailabilitySet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), int? platformUpdateDomainCount = default(int?), int? platformFaultDomainCount = default(int?), IList virtualMachines = default(IList), SubResource proximityPlacementGroup = default(SubResource), IList statuses = default(IList), Sku sku = default(Sku)) + : base(location, id, name, type, tags) + { + PlatformUpdateDomainCount = platformUpdateDomainCount; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachines = virtualMachines; + ProximityPlacementGroup = proximityPlacementGroup; + Statuses = statuses; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets update Domain count. + /// + [JsonProperty(PropertyName = "properties.platformUpdateDomainCount")] + public int? PlatformUpdateDomainCount { get; set; } + + /// + /// Gets or sets fault Domain count. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; set; } + + /// + /// Gets or sets a list of references to all virtual machines in the + /// availability set. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the availability set should be assigned to. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets the resource status information. + /// + [JsonProperty(PropertyName = "properties.statuses")] + public IList Statuses { get; private set; } + + /// + /// Gets or sets sku of the availability set, only name is required to + /// be set. See AvailabilitySetSkuTypes for possible set of values. Use + /// 'Aligned' for virtual machines with managed disks and 'Classic' for + /// virtual machines with unmanaged disks. Default value is 'Classic'. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySetSkuTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySetSkuTypes.cs new file mode 100644 index 0000000000000..489413a557c25 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySetSkuTypes.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 AvailabilitySetSkuTypes. + /// + public static class AvailabilitySetSkuTypes + { + public const string Classic = "Classic"; + public const string Aligned = "Aligned"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySetUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySetUpdate.cs new file mode 100644 index 0000000000000..7249426adf54e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailabilitySetUpdate.cs @@ -0,0 +1,108 @@ +// +// 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 availability set that the virtual + /// machine should be assigned to. Only tags may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class AvailabilitySetUpdate : UpdateResource + { + /// + /// Initializes a new instance of the AvailabilitySetUpdate class. + /// + public AvailabilitySetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailabilitySetUpdate class. + /// + /// Resource tags + /// Update Domain + /// count. + /// Fault Domain count. + /// A list of references to all virtual + /// machines in the availability set. + /// Specifies information about + /// the proximity placement group that the availability set should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// The resource status information. + /// Sku of the availability set + public AvailabilitySetUpdate(IDictionary tags = default(IDictionary), int? platformUpdateDomainCount = default(int?), int? platformFaultDomainCount = default(int?), IList virtualMachines = default(IList), SubResource proximityPlacementGroup = default(SubResource), IList statuses = default(IList), Sku sku = default(Sku)) + : base(tags) + { + PlatformUpdateDomainCount = platformUpdateDomainCount; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachines = virtualMachines; + ProximityPlacementGroup = proximityPlacementGroup; + Statuses = statuses; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets update Domain count. + /// + [JsonProperty(PropertyName = "properties.platformUpdateDomainCount")] + public int? PlatformUpdateDomainCount { get; set; } + + /// + /// Gets or sets fault Domain count. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; set; } + + /// + /// Gets or sets a list of references to all virtual machines in the + /// availability set. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the availability set should be assigned to. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets the resource status information. + /// + [JsonProperty(PropertyName = "properties.statuses")] + public IList Statuses { get; private set; } + + /// + /// Gets or sets sku of the availability set + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailablePatchSummary.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailablePatchSummary.cs new file mode 100644 index 0000000000000..322c7909b5926 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailablePatchSummary.cs @@ -0,0 +1,134 @@ +// +// 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 properties of an virtual machine instance view for + /// available patch summary. + /// + public partial class AvailablePatchSummary + { + /// + /// Initializes a new instance of the AvailablePatchSummary class. + /// + public AvailablePatchSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailablePatchSummary class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the operation + /// that produced this result. It is used to correlate across CRP and + /// extension logs. + /// The overall reboot status of the VM. It + /// will be true when partially installed patches require a reboot to + /// complete installation but the reboot has not yet occurred. + /// The number of critical + /// or security patches that have been detected as available and not + /// yet installed. + /// The number of all available patches + /// excluding critical and security. + /// The UTC timestamp when the operation + /// began. + /// The UTC timestamp when the operation + /// began. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public AvailablePatchSummary(string status = default(string), string assessmentActivityId = default(string), bool? rebootPending = default(bool?), int? criticalAndSecurityPatchCount = default(int?), int? otherPatchCount = default(int?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? lastModifiedTime = default(System.DateTime?), ApiError error = default(ApiError)) + { + Status = status; + AssessmentActivityId = assessmentActivityId; + RebootPending = rebootPending; + CriticalAndSecurityPatchCount = criticalAndSecurityPatchCount; + OtherPatchCount = otherPatchCount; + StartTime = startTime; + LastModifiedTime = lastModifiedTime; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "assessmentActivityId")] + public string AssessmentActivityId { get; private set; } + + /// + /// Gets the overall reboot status of the VM. It will be true when + /// partially installed patches require a reboot to complete + /// installation but the reboot has not yet occurred. + /// + [JsonProperty(PropertyName = "rebootPending")] + public bool? RebootPending { get; private set; } + + /// + /// Gets the number of critical or security patches that have been + /// detected as available and not yet installed. + /// + [JsonProperty(PropertyName = "criticalAndSecurityPatchCount")] + public int? CriticalAndSecurityPatchCount { get; private set; } + + /// + /// Gets the number of all available patches excluding critical and + /// security. + /// + [JsonProperty(PropertyName = "otherPatchCount")] + public int? OtherPatchCount { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BillingProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BillingProfile.cs new file mode 100644 index 0000000000000..8f0e50d186b3d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BillingProfile.cs @@ -0,0 +1,86 @@ +// +// 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; + + /// + /// Specifies the billing related details of a Azure Spot VM or VMSS. + /// <br><br>Minimum api-version: 2019-03-01. + /// + public partial class BillingProfile + { + /// + /// Initializes a new instance of the BillingProfile class. + /// + public BillingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfile class. + /// + /// Specifies the maximum price you are willing + /// to pay for a Azure Spot VM/VMSS. This price is in US Dollars. + /// <br><br> This price will be compared with the current + /// Azure Spot price for the VM size. Also, the prices are compared at + /// the time of create/update of Azure Spot VM/VMSS and the operation + /// will only succeed if the maxPrice is greater than the current + /// Azure Spot price. <br><br> The maxPrice will also be + /// used for evicting a Azure Spot VM/VMSS if the current Azure Spot + /// price goes beyond the maxPrice after creation of VM/VMSS. + /// <br><br> Possible values are: <br><br> - + /// Any decimal value greater than zero. Example: 0.01538 + /// <br><br> -1 – indicates default price to be up-to + /// on-demand. <br><br> You can set the maxPrice to -1 to + /// indicate that the Azure Spot VM/VMSS should not be evicted for + /// price reasons. Also, the default max price is -1 if it is not + /// provided by you. <br><br>Minimum api-version: + /// 2019-03-01. + public BillingProfile(double? maxPrice = default(double?)) + { + MaxPrice = maxPrice; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the maximum price you are willing to pay for + /// a Azure Spot VM/VMSS. This price is in US Dollars. + /// &lt;br&gt;&lt;br&gt; This price will be compared + /// with the current Azure Spot price for the VM size. Also, the prices + /// are compared at the time of create/update of Azure Spot VM/VMSS and + /// the operation will only succeed if the maxPrice is greater than + /// the current Azure Spot price. &lt;br&gt;&lt;br&gt; + /// The maxPrice will also be used for evicting a Azure Spot VM/VMSS if + /// the current Azure Spot price goes beyond the maxPrice after + /// creation of VM/VMSS. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; - Any decimal + /// value greater than zero. Example: 0.01538 + /// &lt;br&gt;&lt;br&gt; -1 – indicates default price + /// to be up-to on-demand. &lt;br&gt;&lt;br&gt; You can + /// set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS + /// should not be evicted for price reasons. Also, the default max + /// price is -1 if it is not provided by you. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2019-03-01. + /// + [JsonProperty(PropertyName = "maxPrice")] + public double? MaxPrice { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BootDiagnostics.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BootDiagnostics.cs new file mode 100644 index 0000000000000..1646e4bc2299b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BootDiagnostics.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.Linq; + + /// + /// Boot Diagnostics is a debugging feature which allows you to view + /// Console Output and Screenshot to diagnose VM status. + /// <br><br> You can easily view the output of your console + /// log. <br><br> Azure also enables you to see a screenshot of + /// the VM from the hypervisor. + /// + public partial class BootDiagnostics + { + /// + /// Initializes a new instance of the BootDiagnostics class. + /// + public BootDiagnostics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BootDiagnostics class. + /// + /// Whether boot diagnostics should be enabled on + /// the Virtual Machine. + /// Uri of the storage account to use for + /// placing the console output and screenshot. <br><br>If + /// storageUri is not specified while enabling boot diagnostics, + /// managed storage will be used. + public BootDiagnostics(bool? enabled = default(bool?), string storageUri = default(string)) + { + Enabled = enabled; + StorageUri = storageUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether boot diagnostics should be enabled on the + /// Virtual Machine. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets uri of the storage account to use for placing the + /// console output and screenshot. + /// &lt;br&gt;&lt;br&gt;If storageUri is not specified + /// while enabling boot diagnostics, managed storage will be used. + /// + [JsonProperty(PropertyName = "storageUri")] + public string StorageUri { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BootDiagnosticsInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BootDiagnosticsInstanceView.cs new file mode 100644 index 0000000000000..63094eb26dbd0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/BootDiagnosticsInstanceView.cs @@ -0,0 +1,81 @@ +// +// 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 instance view of a virtual machine boot diagnostics. + /// + public partial class BootDiagnosticsInstanceView + { + /// + /// Initializes a new instance of the BootDiagnosticsInstanceView + /// class. + /// + public BootDiagnosticsInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BootDiagnosticsInstanceView + /// class. + /// + /// The console screenshot blob + /// URI. <br><br>NOTE: This will **not** be set if boot + /// diagnostics is currently enabled with managed storage. + /// The serial console log blob + /// Uri. <br><br>NOTE: This will **not** be set if boot + /// diagnostics is currently enabled with managed storage. + /// The boot diagnostics status information for + /// the VM. <br><br> NOTE: It will be set only if there are + /// errors encountered in enabling boot diagnostics. + public BootDiagnosticsInstanceView(string consoleScreenshotBlobUri = default(string), string serialConsoleLogBlobUri = default(string), InstanceViewStatus status = default(InstanceViewStatus)) + { + ConsoleScreenshotBlobUri = consoleScreenshotBlobUri; + SerialConsoleLogBlobUri = serialConsoleLogBlobUri; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the console screenshot blob URI. + /// &lt;br&gt;&lt;br&gt;NOTE: This will **not** be set + /// if boot diagnostics is currently enabled with managed storage. + /// + [JsonProperty(PropertyName = "consoleScreenshotBlobUri")] + public string ConsoleScreenshotBlobUri { get; private set; } + + /// + /// Gets the serial console log blob Uri. + /// &lt;br&gt;&lt;br&gt;NOTE: This will **not** be set + /// if boot diagnostics is currently enabled with managed storage. + /// + [JsonProperty(PropertyName = "serialConsoleLogBlobUri")] + public string SerialConsoleLogBlobUri { get; private set; } + + /// + /// Gets the boot diagnostics status information for the VM. + /// &lt;br&gt;&lt;br&gt; NOTE: It will be set only if + /// there are errors encountered in enabling boot diagnostics. + /// + [JsonProperty(PropertyName = "status")] + public InstanceViewStatus Status { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CachingTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CachingTypes.cs new file mode 100644 index 0000000000000..c902e8e5286a3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CachingTypes.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for CachingTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CachingTypes + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "ReadOnly")] + ReadOnly, + [EnumMember(Value = "ReadWrite")] + ReadWrite + } + internal static class CachingTypesEnumExtension + { + internal static string ToSerializedValue(this CachingTypes? value) + { + return value == null ? null : ((CachingTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this CachingTypes value) + { + switch( value ) + { + case CachingTypes.None: + return "None"; + case CachingTypes.ReadOnly: + return "ReadOnly"; + case CachingTypes.ReadWrite: + return "ReadWrite"; + } + return null; + } + + internal static CachingTypes? ParseCachingTypes(this string value) + { + switch( value ) + { + case "None": + return CachingTypes.None; + case "ReadOnly": + return CachingTypes.ReadOnly; + case "ReadWrite": + return CachingTypes.ReadWrite; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComponentNames.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComponentNames.cs new file mode 100644 index 0000000000000..fa005a8109a2e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComponentNames.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ComponentNames. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ComponentNames + { + [EnumMember(Value = "Microsoft-Windows-Shell-Setup")] + MicrosoftWindowsShellSetup + } + internal static class ComponentNamesEnumExtension + { + internal static string ToSerializedValue(this ComponentNames? value) + { + return value == null ? null : ((ComponentNames)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ComponentNames value) + { + switch( value ) + { + case ComponentNames.MicrosoftWindowsShellSetup: + return "Microsoft-Windows-Shell-Setup"; + } + return null; + } + + internal static ComponentNames? ParseComponentNames(this string value) + { + switch( value ) + { + case "Microsoft-Windows-Shell-Setup": + return ComponentNames.MicrosoftWindowsShellSetup; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComputeOperationValue.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComputeOperationValue.cs new file mode 100644 index 0000000000000..56229fc0bdf15 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComputeOperationValue.cs @@ -0,0 +1,97 @@ +// +// 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 the properties of a Compute Operation value. + /// + [Rest.Serialization.JsonTransformation] + public partial class ComputeOperationValue + { + /// + /// Initializes a new instance of the ComputeOperationValue class. + /// + public ComputeOperationValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeOperationValue class. + /// + /// The origin of the compute operation. + /// The name of the compute operation. + /// The display name of the compute + /// operation. + /// The display name of the resource the + /// operation applies to. + /// The description of the operation. + /// The resource provider for the + /// operation. + public ComputeOperationValue(string origin = default(string), string name = default(string), string operation = default(string), string resource = default(string), string description = default(string), string provider = default(string)) + { + Origin = origin; + Name = name; + Operation = operation; + Resource = resource; + Description = description; + Provider = provider; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the origin of the compute operation. + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets the name of the compute operation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the display name of the compute operation. + /// + [JsonProperty(PropertyName = "display.operation")] + public string Operation { get; private set; } + + /// + /// Gets the display name of the resource the operation applies to. + /// + [JsonProperty(PropertyName = "display.resource")] + public string Resource { get; private set; } + + /// + /// Gets the description of the operation. + /// + [JsonProperty(PropertyName = "display.description")] + public string Description { get; private set; } + + /// + /// Gets the resource provider for the operation. + /// + [JsonProperty(PropertyName = "display.provider")] + public string Provider { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerService.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerService.cs new file mode 100644 index 0000000000000..e762dad4d1f71 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerService.cs @@ -0,0 +1,192 @@ +// +// 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; + + /// + /// Container service. + /// + [Rest.Serialization.JsonTransformation] + public partial class ContainerService : Resource + { + /// + /// Initializes a new instance of the ContainerService class. + /// + public ContainerService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerService class. + /// + /// Resource location + /// Properties of master agents. + /// Properties of the agent + /// pool. + /// Properties of Linux VMs. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// the current deployment or + /// provisioning state, which only appears in the response. + /// Properties of the + /// orchestrator. + /// Properties for custom clusters. + /// Properties for cluster + /// service principals. + /// Properties of Windows VMs. + /// Properties of the diagnostic + /// agent. + public ContainerService(string location, ContainerServiceMasterProfile masterProfile, IList agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), ContainerServiceOrchestratorProfile orchestratorProfile = default(ContainerServiceOrchestratorProfile), ContainerServiceCustomProfile customProfile = default(ContainerServiceCustomProfile), ContainerServiceServicePrincipalProfile servicePrincipalProfile = default(ContainerServiceServicePrincipalProfile), ContainerServiceWindowsProfile windowsProfile = default(ContainerServiceWindowsProfile), ContainerServiceDiagnosticsProfile diagnosticsProfile = default(ContainerServiceDiagnosticsProfile)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + OrchestratorProfile = orchestratorProfile; + CustomProfile = customProfile; + ServicePrincipalProfile = servicePrincipalProfile; + MasterProfile = masterProfile; + AgentPoolProfiles = agentPoolProfiles; + WindowsProfile = windowsProfile; + LinuxProfile = linuxProfile; + DiagnosticsProfile = diagnosticsProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets properties of the orchestrator. + /// + [JsonProperty(PropertyName = "properties.orchestratorProfile")] + public ContainerServiceOrchestratorProfile OrchestratorProfile { get; set; } + + /// + /// Gets or sets properties for custom clusters. + /// + [JsonProperty(PropertyName = "properties.customProfile")] + public ContainerServiceCustomProfile CustomProfile { get; set; } + + /// + /// Gets or sets properties for cluster service principals. + /// + [JsonProperty(PropertyName = "properties.servicePrincipalProfile")] + public ContainerServiceServicePrincipalProfile ServicePrincipalProfile { get; set; } + + /// + /// Gets or sets properties of master agents. + /// + [JsonProperty(PropertyName = "properties.masterProfile")] + public ContainerServiceMasterProfile MasterProfile { get; set; } + + /// + /// Gets or sets properties of the agent pool. + /// + [JsonProperty(PropertyName = "properties.agentPoolProfiles")] + public IList AgentPoolProfiles { get; set; } + + /// + /// Gets or sets properties of Windows VMs. + /// + [JsonProperty(PropertyName = "properties.windowsProfile")] + public ContainerServiceWindowsProfile WindowsProfile { get; set; } + + /// + /// Gets or sets properties of Linux VMs. + /// + [JsonProperty(PropertyName = "properties.linuxProfile")] + public ContainerServiceLinuxProfile LinuxProfile { get; set; } + + /// + /// Gets or sets properties of the diagnostic agent. + /// + [JsonProperty(PropertyName = "properties.diagnosticsProfile")] + public ContainerServiceDiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (MasterProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MasterProfile"); + } + if (AgentPoolProfiles == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AgentPoolProfiles"); + } + if (LinuxProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LinuxProfile"); + } + if (OrchestratorProfile != null) + { + OrchestratorProfile.Validate(); + } + if (CustomProfile != null) + { + CustomProfile.Validate(); + } + if (ServicePrincipalProfile != null) + { + ServicePrincipalProfile.Validate(); + } + if (MasterProfile != null) + { + MasterProfile.Validate(); + } + if (AgentPoolProfiles != null) + { + foreach (var element in AgentPoolProfiles) + { + if (element != null) + { + element.Validate(); + } + } + } + if (WindowsProfile != null) + { + WindowsProfile.Validate(); + } + if (LinuxProfile != null) + { + LinuxProfile.Validate(); + } + if (DiagnosticsProfile != null) + { + DiagnosticsProfile.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceAgentPoolProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceAgentPoolProfile.cs new file mode 100644 index 0000000000000..df3842392e843 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceAgentPoolProfile.cs @@ -0,0 +1,149 @@ +// +// 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; + + /// + /// Profile for the container service agent pool. + /// + public partial class ContainerServiceAgentPoolProfile + { + /// + /// Initializes a new instance of the ContainerServiceAgentPoolProfile + /// class. + /// + public ContainerServiceAgentPoolProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceAgentPoolProfile + /// class. + /// + /// Unique name of the agent pool profile in the + /// context of the subscription and resource group. + /// Number of agents (VMs) to host docker + /// containers. Allowed values must be in the range of 1 to 100 + /// (inclusive). The default value is 1. + /// Size of agent VMs. Possible values include: + /// 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', + /// 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', + /// 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', + /// 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4', + /// 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14', + /// 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', + /// 'Standard_D4_v2', 'Standard_D5_v2', 'Standard_D11_v2', + /// 'Standard_D12_v2', 'Standard_D13_v2', 'Standard_D14_v2', + /// 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + /// 'Standard_G5', 'Standard_DS1', 'Standard_DS2', 'Standard_DS3', + /// 'Standard_DS4', 'Standard_DS11', 'Standard_DS12', 'Standard_DS13', + /// 'Standard_DS14', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + /// 'Standard_GS4', 'Standard_GS5' + /// DNS prefix to be used to create the FQDN + /// for the agent pool. + /// FQDN for the agent pool. + public ContainerServiceAgentPoolProfile(string name, int count, string vmSize, string dnsPrefix, string fqdn = default(string)) + { + Name = name; + Count = count; + VmSize = vmSize; + DnsPrefix = dnsPrefix; + Fqdn = fqdn; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique name of the agent pool profile in the context + /// of the subscription and resource group. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets number of agents (VMs) to host docker containers. + /// Allowed values must be in the range of 1 to 100 (inclusive). The + /// default value is 1. + /// + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + + /// + /// Gets or sets size of agent VMs. Possible values include: + /// 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', + /// 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', + /// 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', + /// 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4', + /// 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14', + /// 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', + /// 'Standard_D4_v2', 'Standard_D5_v2', 'Standard_D11_v2', + /// 'Standard_D12_v2', 'Standard_D13_v2', 'Standard_D14_v2', + /// 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + /// 'Standard_G5', 'Standard_DS1', 'Standard_DS2', 'Standard_DS3', + /// 'Standard_DS4', 'Standard_DS11', 'Standard_DS12', 'Standard_DS13', + /// 'Standard_DS14', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + /// 'Standard_GS4', 'Standard_GS5' + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets DNS prefix to be used to create the FQDN for the agent + /// pool. + /// + [JsonProperty(PropertyName = "dnsPrefix")] + public string DnsPrefix { get; set; } + + /// + /// Gets FQDN for the agent pool. + /// + [JsonProperty(PropertyName = "fqdn")] + public string Fqdn { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (VmSize == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VmSize"); + } + if (DnsPrefix == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DnsPrefix"); + } + if (Count > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Count", 100); + } + if (Count < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Count", 1); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceCustomProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceCustomProfile.cs new file mode 100644 index 0000000000000..d732cb9bd5ec5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceCustomProfile.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties to configure a custom container service cluster. + /// + public partial class ContainerServiceCustomProfile + { + /// + /// Initializes a new instance of the ContainerServiceCustomProfile + /// class. + /// + public ContainerServiceCustomProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceCustomProfile + /// class. + /// + /// The name of the custom orchestrator to + /// use. + public ContainerServiceCustomProfile(string orchestrator) + { + Orchestrator = orchestrator; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the custom orchestrator to use. + /// + [JsonProperty(PropertyName = "orchestrator")] + public string Orchestrator { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Orchestrator == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Orchestrator"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceDiagnosticsProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceDiagnosticsProfile.cs new file mode 100644 index 0000000000000..9df627f026d7e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceDiagnosticsProfile.cs @@ -0,0 +1,69 @@ +// +// 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 ContainerServiceDiagnosticsProfile + { + /// + /// Initializes a new instance of the + /// ContainerServiceDiagnosticsProfile class. + /// + public ContainerServiceDiagnosticsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ContainerServiceDiagnosticsProfile class. + /// + /// Profile for the container service VM + /// diagnostic agent. + public ContainerServiceDiagnosticsProfile(ContainerServiceVMDiagnostics vmDiagnostics) + { + VmDiagnostics = vmDiagnostics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets profile for the container service VM diagnostic agent. + /// + [JsonProperty(PropertyName = "vmDiagnostics")] + public ContainerServiceVMDiagnostics VmDiagnostics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VmDiagnostics == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VmDiagnostics"); + } + if (VmDiagnostics != null) + { + VmDiagnostics.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceLinuxProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceLinuxProfile.cs new file mode 100644 index 0000000000000..0ad1e8815b923 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceLinuxProfile.cs @@ -0,0 +1,91 @@ +// +// 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; + + /// + /// Profile for Linux VMs in the container service cluster. + /// + public partial class ContainerServiceLinuxProfile + { + /// + /// Initializes a new instance of the ContainerServiceLinuxProfile + /// class. + /// + public ContainerServiceLinuxProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceLinuxProfile + /// class. + /// + /// The administrator username to use for + /// Linux VMs. + /// The ssh key configuration for Linux VMs. + public ContainerServiceLinuxProfile(string adminUsername, ContainerServiceSshConfiguration ssh) + { + AdminUsername = adminUsername; + Ssh = ssh; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the administrator username to use for Linux VMs. + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; set; } + + /// + /// Gets or sets the ssh key configuration for Linux VMs. + /// + [JsonProperty(PropertyName = "ssh")] + public ContainerServiceSshConfiguration Ssh { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AdminUsername == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminUsername"); + } + if (Ssh == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Ssh"); + } + if (AdminUsername != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(AdminUsername, "^[a-z][a-z0-9_-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "AdminUsername", "^[a-z][a-z0-9_-]*$"); + } + } + if (Ssh != null) + { + Ssh.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceMasterProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceMasterProfile.cs new file mode 100644 index 0000000000000..0c9539edf0341 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceMasterProfile.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Profile for the container service master. + /// + public partial class ContainerServiceMasterProfile + { + /// + /// Initializes a new instance of the ContainerServiceMasterProfile + /// class. + /// + public ContainerServiceMasterProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceMasterProfile + /// class. + /// + /// DNS prefix to be used to create the FQDN + /// for master. + /// Number of masters (VMs) in the container + /// service cluster. Allowed values are 1, 3, and 5. The default value + /// is 1. + /// FQDN for the master. + public ContainerServiceMasterProfile(string dnsPrefix, int? count = default(int?), string fqdn = default(string)) + { + Count = count; + DnsPrefix = dnsPrefix; + Fqdn = fqdn; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of masters (VMs) in the container service + /// cluster. Allowed values are 1, 3, and 5. The default value is 1. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; set; } + + /// + /// Gets or sets DNS prefix to be used to create the FQDN for master. + /// + [JsonProperty(PropertyName = "dnsPrefix")] + public string DnsPrefix { get; set; } + + /// + /// Gets FQDN for the master. + /// + [JsonProperty(PropertyName = "fqdn")] + public string Fqdn { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DnsPrefix == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DnsPrefix"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceOrchestratorProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceOrchestratorProfile.cs new file mode 100644 index 0000000000000..169410d83efb5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceOrchestratorProfile.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; + + /// + /// Profile for the container service orchestrator. + /// + public partial class ContainerServiceOrchestratorProfile + { + /// + /// Initializes a new instance of the + /// ContainerServiceOrchestratorProfile class. + /// + public ContainerServiceOrchestratorProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ContainerServiceOrchestratorProfile class. + /// + /// The orchestrator to use to manage + /// container service cluster resources. Valid values are Swarm, DCOS, + /// and Custom. Possible values include: 'Swarm', 'DCOS', 'Custom', + /// 'Kubernetes' + public ContainerServiceOrchestratorProfile(ContainerServiceOrchestratorTypes orchestratorType) + { + OrchestratorType = orchestratorType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the orchestrator to use to manage container service + /// cluster resources. Valid values are Swarm, DCOS, and Custom. + /// Possible values include: 'Swarm', 'DCOS', 'Custom', 'Kubernetes' + /// + [JsonProperty(PropertyName = "orchestratorType")] + public ContainerServiceOrchestratorTypes OrchestratorType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceOrchestratorTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceOrchestratorTypes.cs new file mode 100644 index 0000000000000..390ea4b569c1b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceOrchestratorTypes.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ContainerServiceOrchestratorTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ContainerServiceOrchestratorTypes + { + [EnumMember(Value = "Swarm")] + Swarm, + [EnumMember(Value = "DCOS")] + DCOS, + [EnumMember(Value = "Custom")] + Custom, + [EnumMember(Value = "Kubernetes")] + Kubernetes + } + internal static class ContainerServiceOrchestratorTypesEnumExtension + { + internal static string ToSerializedValue(this ContainerServiceOrchestratorTypes? value) + { + return value == null ? null : ((ContainerServiceOrchestratorTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ContainerServiceOrchestratorTypes value) + { + switch( value ) + { + case ContainerServiceOrchestratorTypes.Swarm: + return "Swarm"; + case ContainerServiceOrchestratorTypes.DCOS: + return "DCOS"; + case ContainerServiceOrchestratorTypes.Custom: + return "Custom"; + case ContainerServiceOrchestratorTypes.Kubernetes: + return "Kubernetes"; + } + return null; + } + + internal static ContainerServiceOrchestratorTypes? ParseContainerServiceOrchestratorTypes(this string value) + { + switch( value ) + { + case "Swarm": + return ContainerServiceOrchestratorTypes.Swarm; + case "DCOS": + return ContainerServiceOrchestratorTypes.DCOS; + case "Custom": + return ContainerServiceOrchestratorTypes.Custom; + case "Kubernetes": + return ContainerServiceOrchestratorTypes.Kubernetes; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceServicePrincipalProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceServicePrincipalProfile.cs new file mode 100644 index 0000000000000..f3388c2d38653 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceServicePrincipalProfile.cs @@ -0,0 +1,82 @@ +// +// 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; + + /// + /// Information about a service principal identity for the cluster to use + /// for manipulating Azure APIs. + /// + public partial class ContainerServiceServicePrincipalProfile + { + /// + /// Initializes a new instance of the + /// ContainerServiceServicePrincipalProfile class. + /// + public ContainerServiceServicePrincipalProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ContainerServiceServicePrincipalProfile class. + /// + /// The ID for the service principal. + /// The secret password associated with the + /// service principal. + public ContainerServiceServicePrincipalProfile(string clientId, string secret) + { + ClientId = clientId; + Secret = secret; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ID for the service principal. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; set; } + + /// + /// Gets or sets the secret password associated with the service + /// principal. + /// + [JsonProperty(PropertyName = "secret")] + public string Secret { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ClientId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ClientId"); + } + if (Secret == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Secret"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceSshConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceSshConfiguration.cs new file mode 100644 index 0000000000000..5d3cf56fa1eec --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceSshConfiguration.cs @@ -0,0 +1,81 @@ +// +// 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; + + /// + /// SSH configuration for Linux-based VMs running on Azure. + /// + public partial class ContainerServiceSshConfiguration + { + /// + /// Initializes a new instance of the ContainerServiceSshConfiguration + /// class. + /// + public ContainerServiceSshConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceSshConfiguration + /// class. + /// + /// the list of SSH public keys used to + /// authenticate with Linux-based VMs. + public ContainerServiceSshConfiguration(IList publicKeys) + { + PublicKeys = publicKeys; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of SSH public keys used to authenticate with + /// Linux-based VMs. + /// + [JsonProperty(PropertyName = "publicKeys")] + public IList PublicKeys { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PublicKeys == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PublicKeys"); + } + if (PublicKeys != null) + { + foreach (var element in PublicKeys) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceSshPublicKey.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceSshPublicKey.cs new file mode 100644 index 0000000000000..36d950106abd4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceSshPublicKey.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information about SSH certificate public key data. + /// + public partial class ContainerServiceSshPublicKey + { + /// + /// Initializes a new instance of the ContainerServiceSshPublicKey + /// class. + /// + public ContainerServiceSshPublicKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceSshPublicKey + /// class. + /// + /// Certificate public key used to authenticate + /// with VMs through SSH. The certificate must be in PEM format with or + /// without headers. + public ContainerServiceSshPublicKey(string keyData) + { + KeyData = keyData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets certificate public key used to authenticate with VMs + /// through SSH. The certificate must be in PEM format with or without + /// headers. + /// + [JsonProperty(PropertyName = "keyData")] + public string KeyData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyData"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceVMDiagnostics.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceVMDiagnostics.cs new file mode 100644 index 0000000000000..31cb6845c8c09 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceVMDiagnostics.cs @@ -0,0 +1,74 @@ +// +// 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; + + /// + /// Profile for diagnostics on the container service VMs. + /// + public partial class ContainerServiceVMDiagnostics + { + /// + /// Initializes a new instance of the ContainerServiceVMDiagnostics + /// class. + /// + public ContainerServiceVMDiagnostics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceVMDiagnostics + /// class. + /// + /// Whether the VM diagnostic agent is + /// provisioned on the VM. + /// The URI of the storage account where + /// diagnostics are stored. + public ContainerServiceVMDiagnostics(bool enabled, string storageUri = default(string)) + { + Enabled = enabled; + StorageUri = storageUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether the VM diagnostic agent is provisioned on the + /// VM. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the URI of the storage account where diagnostics are stored. + /// + [JsonProperty(PropertyName = "storageUri")] + public string StorageUri { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceVMSizeTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceVMSizeTypes.cs new file mode 100644 index 0000000000000..d31363e9854b2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceVMSizeTypes.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 +{ + + /// + /// Defines values for ContainerServiceVMSizeTypes. + /// + public static class ContainerServiceVMSizeTypes + { + public const string StandardA0 = "Standard_A0"; + public const string StandardA1 = "Standard_A1"; + public const string StandardA2 = "Standard_A2"; + public const string StandardA3 = "Standard_A3"; + public const string StandardA4 = "Standard_A4"; + public const string StandardA5 = "Standard_A5"; + public const string StandardA6 = "Standard_A6"; + public const string StandardA7 = "Standard_A7"; + public const string StandardA8 = "Standard_A8"; + public const string StandardA9 = "Standard_A9"; + public const string StandardA10 = "Standard_A10"; + public const string StandardA11 = "Standard_A11"; + public const string StandardD1 = "Standard_D1"; + public const string StandardD2 = "Standard_D2"; + public const string StandardD3 = "Standard_D3"; + public const string StandardD4 = "Standard_D4"; + public const string StandardD11 = "Standard_D11"; + public const string StandardD12 = "Standard_D12"; + public const string StandardD13 = "Standard_D13"; + public const string StandardD14 = "Standard_D14"; + public const string StandardD1V2 = "Standard_D1_v2"; + public const string StandardD2V2 = "Standard_D2_v2"; + public const string StandardD3V2 = "Standard_D3_v2"; + public const string StandardD4V2 = "Standard_D4_v2"; + public const string StandardD5V2 = "Standard_D5_v2"; + public const string StandardD11V2 = "Standard_D11_v2"; + public const string StandardD12V2 = "Standard_D12_v2"; + public const string StandardD13V2 = "Standard_D13_v2"; + public const string StandardD14V2 = "Standard_D14_v2"; + public const string StandardG1 = "Standard_G1"; + public const string StandardG2 = "Standard_G2"; + public const string StandardG3 = "Standard_G3"; + public const string StandardG4 = "Standard_G4"; + public const string StandardG5 = "Standard_G5"; + public const string StandardDS1 = "Standard_DS1"; + public const string StandardDS2 = "Standard_DS2"; + public const string StandardDS3 = "Standard_DS3"; + public const string StandardDS4 = "Standard_DS4"; + public const string StandardDS11 = "Standard_DS11"; + public const string StandardDS12 = "Standard_DS12"; + public const string StandardDS13 = "Standard_DS13"; + public const string StandardDS14 = "Standard_DS14"; + public const string StandardGS1 = "Standard_GS1"; + public const string StandardGS2 = "Standard_GS2"; + public const string StandardGS3 = "Standard_GS3"; + public const string StandardGS4 = "Standard_GS4"; + public const string StandardGS5 = "Standard_GS5"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceWindowsProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceWindowsProfile.cs new file mode 100644 index 0000000000000..671adcedd2144 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ContainerServiceWindowsProfile.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; + + /// + /// Profile for Windows VMs in the container service cluster. + /// + public partial class ContainerServiceWindowsProfile + { + /// + /// Initializes a new instance of the ContainerServiceWindowsProfile + /// class. + /// + public ContainerServiceWindowsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerServiceWindowsProfile + /// class. + /// + /// The administrator username to use for + /// Windows VMs. + /// The administrator password to use for + /// Windows VMs. + public ContainerServiceWindowsProfile(string adminUsername, string adminPassword) + { + AdminUsername = adminUsername; + AdminPassword = adminPassword; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the administrator username to use for Windows VMs. + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; set; } + + /// + /// Gets or sets the administrator password to use for Windows VMs. + /// + [JsonProperty(PropertyName = "adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AdminUsername == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminUsername"); + } + if (AdminPassword == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminPassword"); + } + if (AdminUsername != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(AdminUsername, "^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "AdminUsername", "^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$"); + } + } + if (AdminPassword != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(AdminPassword, "^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\\^&\\*\\(\\)])[a-zA-Z\\d!@#$%\\^&\\*\\(\\)]{12,123}$")) + { + throw new ValidationException(ValidationRules.Pattern, "AdminPassword", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\\^&\\*\\(\\)])[a-zA-Z\\d!@#$%\\^&\\*\\(\\)]{12,123}$"); + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CreationData.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CreationData.cs new file mode 100644 index 0000000000000..c0f74c0583d57 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CreationData.cs @@ -0,0 +1,166 @@ +// +// 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; + + /// + /// Data used when creating a disk. + /// + public partial class CreationData + { + /// + /// Initializes a new instance of the CreationData class. + /// + public CreationData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreationData class. + /// + /// This enumerates the possible sources of + /// a disk's creation. Possible values include: 'Empty', 'Attach', + /// 'FromImage', 'Import', 'Copy', 'Restore', 'Upload' + /// Required if createOption is Import. + /// The Azure Resource Manager identifier of the storage account + /// containing the blob to import as a disk. + /// Disk source information. + /// Required if creating from a + /// Gallery Image. The id of the ImageDiskReference will be the ARM id + /// of the shared galley image version from which to create a + /// disk. + /// If createOption is Import, this is the URI + /// of a blob to be imported into a managed disk. + /// If createOption is Copy, this is the + /// ARM id of the source snapshot or disk. + /// If this field is set, this is the + /// unique id identifying the source of this resource. + /// If createOption is Upload, this is + /// the size of the contents of the upload including the VHD footer. + /// This value should be between 20972032 (20 MiB + 512 bytes for the + /// VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the + /// VHD footer). + /// Logical sector size in bytes for + /// Ultra disks. Supported values are 512 ad 4096. 4096 is the + /// default. + public CreationData(string createOption, string storageAccountId = default(string), ImageDiskReference imageReference = default(ImageDiskReference), ImageDiskReference galleryImageReference = default(ImageDiskReference), string sourceUri = default(string), string sourceResourceId = default(string), string sourceUniqueId = default(string), long? uploadSizeBytes = default(long?), int? logicalSectorSize = default(int?)) + { + CreateOption = createOption; + StorageAccountId = storageAccountId; + ImageReference = imageReference; + GalleryImageReference = galleryImageReference; + SourceUri = sourceUri; + SourceResourceId = sourceResourceId; + SourceUniqueId = sourceUniqueId; + UploadSizeBytes = uploadSizeBytes; + LogicalSectorSize = logicalSectorSize; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this enumerates the possible sources of a disk's + /// creation. Possible values include: 'Empty', 'Attach', 'FromImage', + /// 'Import', 'Copy', 'Restore', 'Upload' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets required if createOption is Import. The Azure Resource + /// Manager identifier of the storage account containing the blob to + /// import as a disk. + /// + [JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId { get; set; } + + /// + /// Gets or sets disk source information. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageDiskReference ImageReference { get; set; } + + /// + /// Gets or sets required if creating from a Gallery Image. The id of + /// the ImageDiskReference will be the ARM id of the shared galley + /// image version from which to create a disk. + /// + [JsonProperty(PropertyName = "galleryImageReference")] + public ImageDiskReference GalleryImageReference { get; set; } + + /// + /// Gets or sets if createOption is Import, this is the URI of a blob + /// to be imported into a managed disk. + /// + [JsonProperty(PropertyName = "sourceUri")] + public string SourceUri { get; set; } + + /// + /// Gets or sets if createOption is Copy, this is the ARM id of the + /// source snapshot or disk. + /// + [JsonProperty(PropertyName = "sourceResourceId")] + public string SourceResourceId { get; set; } + + /// + /// Gets if this field is set, this is the unique id identifying the + /// source of this resource. + /// + [JsonProperty(PropertyName = "sourceUniqueId")] + public string SourceUniqueId { get; private set; } + + /// + /// Gets or sets if createOption is Upload, this is the size of the + /// contents of the upload including the VHD footer. This value should + /// be between 20972032 (20 MiB + 512 bytes for the VHD footer) and + /// 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + /// + [JsonProperty(PropertyName = "uploadSizeBytes")] + public long? UploadSizeBytes { get; set; } + + /// + /// Gets or sets logical sector size in bytes for Ultra disks. + /// Supported values are 512 ad 4096. 4096 is the default. + /// + [JsonProperty(PropertyName = "logicalSectorSize")] + public int? LogicalSectorSize { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + if (ImageReference != null) + { + ImageReference.Validate(); + } + if (GalleryImageReference != null) + { + GalleryImageReference.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs new file mode 100644 index 0000000000000..4adc5176ab56c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs @@ -0,0 +1,252 @@ +// +// 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; + + /// + /// Describes a data disk. + /// + public partial class DataDisk + { + /// + /// Initializes a new instance of the DataDisk class. + /// + public DataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDisk class. + /// + /// Specifies the logical unit number of the data + /// disk. This value is used to identify data disks within the VM and + /// therefore must be unique for each data disk attached to a + /// VM. + /// Specifies how the virtual machine should + /// be created.<br><br> Possible values + /// are:<br><br> **Attach** \u2013 This value is used when + /// you are using a specialized disk to create the virtual + /// machine.<br><br> **FromImage** \u2013 This value is + /// used when you are using an image to create the virtual machine. If + /// you are using a platform image, you also use the imageReference + /// element described above. If you are using a marketplace image, you + /// also use the plan element previously described. Possible values + /// include: 'FromImage', 'Empty', 'Attach' + /// The disk name. + /// The virtual hard disk. + /// The source user image virtual hard disk. The + /// virtual hard disk will be copied before being attached to the + /// virtual machine. If SourceImage is provided, the destination + /// virtual hard drive must not exist. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. <br><br> This value + /// cannot be larger than 1023 GB + /// The managed disk parameters. + /// Specifies whether the data disk is in + /// process of detachment from the + /// VirtualMachine/VirtualMachineScaleset + /// Specifies the detach behavior to be used + /// while detaching a disk or which is already in the process of + /// detachment from the virtual machine. Supported values: + /// **ForceDetach**. <br><br> detachOption: **ForceDetach** + /// is applicable only for managed data disks. If a previous detachment + /// attempt of the data disk did not complete due to an unexpected + /// failure from the virtual machine and the disk is still not released + /// then use force-detach as a last resort option to detach the disk + /// forcibly from the VM. All writes might not have been flushed when + /// using this detach behavior. <br><br> This feature is + /// still in preview mode and is not supported for + /// VirtualMachineScaleSet. To force-detach a data disk update + /// toBeDetached to 'true' along with setting detachOption: + /// 'ForceDetach'. Possible values include: 'ForceDetach' + /// Specifies the Read-Write IOPS for + /// the managed disk when StorageAccountType is UltraSSD_LRS. Returned + /// only for VirtualMachine ScaleSet VM disks. Can be updated only via + /// updates to the VirtualMachine Scale Set. + /// Specifies the bandwidth in MB per + /// second for the managed disk when StorageAccountType is + /// UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. + /// Can be updated only via updates to the VirtualMachine Scale + /// Set. + public DataDisk(int lun, string createOption, string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), bool? toBeDetached = default(bool?), string detachOption = default(string), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?)) + { + Lun = lun; + Name = name; + Vhd = vhd; + Image = image; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CreateOption = createOption; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + ToBeDetached = toBeDetached; + DetachOption = detachOption; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the logical unit number of the data disk. + /// This value is used to identify data disks within the VM and + /// therefore must be unique for each data disk attached to a VM. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the virtual hard disk. + /// + [JsonProperty(PropertyName = "vhd")] + public VirtualHardDisk Vhd { get; set; } + + /// + /// Gets or sets the source user image virtual hard disk. The virtual + /// hard disk will be copied before being attached to the virtual + /// machine. If SourceImage is provided, the destination virtual hard + /// drive must not exist. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets specifies the caching requirements. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **ReadOnly** + /// &lt;br&gt;&lt;br&gt; **ReadWrite** + /// &lt;br&gt;&lt;br&gt; Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies how the virtual machine should be + /// created.&lt;br&gt;&lt;br&gt; Possible values + /// are:&lt;br&gt;&lt;br&gt; **Attach** \u2013 This + /// value is used when you are using a specialized disk to create the + /// virtual machine.&lt;br&gt;&lt;br&gt; **FromImage** + /// \u2013 This value is used when you are using an image to create the + /// virtual machine. If you are using a platform image, you also use + /// the imageReference element described above. If you are using a + /// marketplace image, you also use the plan element previously + /// described. Possible values include: 'FromImage', 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. &lt;br&gt;&lt;br&gt; This + /// value cannot be larger than 1023 GB + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public ManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets specifies whether the data disk is in process of + /// detachment from the VirtualMachine/VirtualMachineScaleset + /// + [JsonProperty(PropertyName = "toBeDetached")] + public bool? ToBeDetached { get; set; } + + /// + /// Gets or sets specifies the detach behavior to be used while + /// detaching a disk or which is already in the process of detachment + /// from the virtual machine. Supported values: **ForceDetach**. + /// &lt;br&gt;&lt;br&gt; detachOption: **ForceDetach** + /// is applicable only for managed data disks. If a previous detachment + /// attempt of the data disk did not complete due to an unexpected + /// failure from the virtual machine and the disk is still not released + /// then use force-detach as a last resort option to detach the disk + /// forcibly from the VM. All writes might not have been flushed when + /// using this detach behavior. &lt;br&gt;&lt;br&gt; + /// This feature is still in preview mode and is not supported for + /// VirtualMachineScaleSet. To force-detach a data disk update + /// toBeDetached to 'true' along with setting detachOption: + /// 'ForceDetach'. Possible values include: 'ForceDetach' + /// + [JsonProperty(PropertyName = "detachOption")] + public string DetachOption { get; set; } + + /// + /// Gets specifies the Read-Write IOPS for the managed disk when + /// StorageAccountType is UltraSSD_LRS. Returned only for + /// VirtualMachine ScaleSet VM disks. Can be updated only via updates + /// to the VirtualMachine Scale Set. + /// + [JsonProperty(PropertyName = "diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; private set; } + + /// + /// Gets specifies the bandwidth in MB per second for the managed disk + /// when StorageAccountType is UltraSSD_LRS. Returned only for + /// VirtualMachine ScaleSet VM disks. Can be updated only via updates + /// to the VirtualMachine Scale Set. + /// + [JsonProperty(PropertyName = "diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDiskImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDiskImage.cs new file mode 100644 index 0000000000000..2bf7163edbbfd --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDiskImage.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; + + /// + /// Contains the data disk images information. + /// + public partial class DataDiskImage + { + /// + /// Initializes a new instance of the DataDiskImage class. + /// + public DataDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskImage class. + /// + /// Specifies the logical unit number of the data + /// disk. This value is used to identify data disks within the VM and + /// therefore must be unique for each data disk attached to a + /// VM. + public DataDiskImage(int? lun = default(int?)) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the logical unit number of the data disk. This value + /// is used to identify data disks within the VM and therefore must be + /// unique for each data disk attached to a VM. + /// + [JsonProperty(PropertyName = "lun")] + public int? Lun { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDiskImageEncryption.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDiskImageEncryption.cs new file mode 100644 index 0000000000000..a5a6152bb24d7 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDiskImageEncryption.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Contains encryption settings for a data disk image. + /// + public partial class DataDiskImageEncryption : DiskImageEncryption + { + /// + /// Initializes a new instance of the DataDiskImageEncryption class. + /// + public DataDiskImageEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskImageEncryption class. + /// + /// This property specifies the logical unit number + /// of the data disk. This value is used to identify data disks within + /// the Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// A relative URI containing the + /// resource ID of the disk encryption set. + public DataDiskImageEncryption(int lun, string diskEncryptionSetId = default(string)) + : base(diskEncryptionSetId) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property specifies the logical unit number of the + /// data disk. This value is used to identify data disks within the + /// Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHost.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHost.cs new file mode 100644 index 0000000000000..2492e07e7fed4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHost.cs @@ -0,0 +1,177 @@ +// +// 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 Dedicated host. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHost : Resource + { + /// + /// Initializes a new instance of the DedicatedHost class. + /// + public DedicatedHost() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHost class. + /// + /// Resource location + /// SKU of the dedicated host for Hardware Generation + /// and VM family. Only name is required to be set. List + /// Microsoft.Compute SKUs for a list of possible values. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Fault domain of the dedicated + /// host within a dedicated host group. + /// Specifies whether the dedicated + /// host should be replaced automatically in case of a failure. The + /// value is defaulted to 'true' when not provided. + /// A unique id generated and assigned to the + /// dedicated host by the platform. <br><br> Does not + /// change throughout the lifetime of the host. + /// A list of references to all virtual + /// machines in the Dedicated Host. + /// Specifies the software license type that + /// will be applied to the VMs deployed on the dedicated host. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **Windows_Server_Hybrid** + /// <br><br> **Windows_Server_Perpetual** + /// <br><br> Default: **None**. Possible values include: + /// 'None', 'Windows_Server_Hybrid', 'Windows_Server_Perpetual' + /// The date when the host was first + /// provisioned. + /// The provisioning state, which only + /// appears in the response. + /// The dedicated host instance + /// view. + public DedicatedHost(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), int? platformFaultDomain = default(int?), bool? autoReplaceOnFailure = default(bool?), string hostId = default(string), IList virtualMachines = default(IList), DedicatedHostLicenseTypes? licenseType = default(DedicatedHostLicenseTypes?), System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), DedicatedHostInstanceView instanceView = default(DedicatedHostInstanceView)) + : base(location, id, name, type, tags) + { + PlatformFaultDomain = platformFaultDomain; + AutoReplaceOnFailure = autoReplaceOnFailure; + HostId = hostId; + VirtualMachines = virtualMachines; + LicenseType = licenseType; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fault domain of the dedicated host within a dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies whether the dedicated host should be + /// replaced automatically in case of a failure. The value is defaulted + /// to 'true' when not provided. + /// + [JsonProperty(PropertyName = "properties.autoReplaceOnFailure")] + public bool? AutoReplaceOnFailure { get; set; } + + /// + /// Gets a unique id generated and assigned to the dedicated host by + /// the platform. &lt;br&gt;&lt;br&gt; Does not change + /// throughout the lifetime of the host. + /// + [JsonProperty(PropertyName = "properties.hostId")] + public string HostId { get; private set; } + + /// + /// Gets a list of references to all virtual machines in the Dedicated + /// Host. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; private set; } + + /// + /// Gets or sets specifies the software license type that will be + /// applied to the VMs deployed on the dedicated host. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **Windows_Server_Hybrid** + /// &lt;br&gt;&lt;br&gt; **Windows_Server_Perpetual** + /// &lt;br&gt;&lt;br&gt; Default: **None**. Possible + /// values include: 'None', 'Windows_Server_Hybrid', + /// 'Windows_Server_Perpetual' + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public DedicatedHostLicenseTypes? LicenseType { get; set; } + + /// + /// Gets the date when the host was first provisioned. + /// + [JsonProperty(PropertyName = "properties.provisioningTime")] + public System.DateTime? ProvisioningTime { get; private set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the dedicated host instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets SKU of the dedicated host for Hardware Generation and + /// VM family. Only name is required to be set. List Microsoft.Compute + /// SKUs for a list of possible values. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + if (PlatformFaultDomain < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomain", 0); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostAllocatableVM.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostAllocatableVM.cs new file mode 100644 index 0000000000000..f0fc416b07525 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostAllocatableVM.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// Represents the dedicated host unutilized capacity in terms of a + /// specific VM size. + /// + public partial class DedicatedHostAllocatableVM + { + /// + /// Initializes a new instance of the DedicatedHostAllocatableVM class. + /// + public DedicatedHostAllocatableVM() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostAllocatableVM class. + /// + /// VM size in terms of which the unutilized + /// capacity is represented. + /// Maximum number of VMs of size vmSize that can + /// fit in the dedicated host's remaining capacity. + public DedicatedHostAllocatableVM(string vmSize = default(string), double? count = default(double?)) + { + VmSize = vmSize; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets VM size in terms of which the unutilized capacity is + /// represented. + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets maximum number of VMs of size vmSize that can fit in + /// the dedicated host's remaining capacity. + /// + [JsonProperty(PropertyName = "count")] + public double? Count { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.cs new file mode 100644 index 0000000000000..feb77504562d9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Dedicated host unutilized capacity. + /// + public partial class DedicatedHostAvailableCapacity + { + /// + /// Initializes a new instance of the DedicatedHostAvailableCapacity + /// class. + /// + public DedicatedHostAvailableCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostAvailableCapacity + /// class. + /// + /// The unutilized capacity of the + /// dedicated host represented in terms of each VM size that is allowed + /// to be deployed to the dedicated host. + public DedicatedHostAvailableCapacity(IList allocatableVMs = default(IList)) + { + AllocatableVMs = allocatableVMs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the unutilized capacity of the dedicated host + /// represented in terms of each VM size that is allowed to be deployed + /// to the dedicated host. + /// + [JsonProperty(PropertyName = "allocatableVMs")] + public IList AllocatableVMs { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroup.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroup.cs new file mode 100644 index 0000000000000..bb23e586e1789 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroup.cs @@ -0,0 +1,139 @@ +// +// 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 dedicated host group that the dedicated + /// hosts should be assigned to. <br><br> Currently, a + /// dedicated host can only be added to a dedicated host group at creation + /// time. An existing dedicated host cannot be added to another dedicated + /// host group. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHostGroup : Resource + { + /// + /// Initializes a new instance of the DedicatedHostGroup class. + /// + public DedicatedHostGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostGroup class. + /// + /// Resource location + /// Number of fault domains that + /// the host group can span. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A list of references to all dedicated hosts in + /// the dedicated host group. + /// The dedicated host group instance view, + /// which has the list of instance view of the dedicated hosts under + /// the dedicated host group. + /// Specifies whether virtual + /// machines or virtual machine scale sets can be placed automatically + /// on the dedicated host group. Automatic placement means resources + /// are allocated on dedicated hosts, that are chosen by Azure, under + /// the dedicated host group. The value is defaulted to 'false' when + /// not provided. <br><br>Minimum api-version: + /// 2020-06-01. + /// Availability Zone to use for this host group. + /// Only single zone is supported. The zone can be assigned only during + /// creation. If not provided, the group supports all zones in the + /// region. If provided, enforces each host in the group to be in the + /// same zone. + public DedicatedHostGroup(string location, int platformFaultDomainCount, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList hosts = default(IList), DedicatedHostGroupInstanceView instanceView = default(DedicatedHostGroupInstanceView), bool? supportAutomaticPlacement = default(bool?), IList zones = default(IList)) + : base(location, id, name, type, tags) + { + PlatformFaultDomainCount = platformFaultDomainCount; + Hosts = hosts; + InstanceView = instanceView; + SupportAutomaticPlacement = supportAutomaticPlacement; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of fault domains that the host group can span. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int PlatformFaultDomainCount { get; set; } + + /// + /// Gets a list of references to all dedicated hosts in the dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.hosts")] + public IList Hosts { get; private set; } + + /// + /// Gets the dedicated host group instance view, which has the list of + /// instance view of the dedicated hosts under the dedicated host + /// group. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostGroupInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets specifies whether virtual machines or virtual machine + /// scale sets can be placed automatically on the dedicated host group. + /// Automatic placement means resources are allocated on dedicated + /// hosts, that are chosen by Azure, under the dedicated host group. + /// The value is defaulted to 'false' when not provided. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "properties.supportAutomaticPlacement")] + public bool? SupportAutomaticPlacement { get; set; } + + /// + /// Gets or sets availability Zone to use for this host group. Only + /// single zone is supported. The zone can be assigned only during + /// creation. If not provided, the group supports all zones in the + /// region. If provided, enforces each host in the group to be in the + /// same zone. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (PlatformFaultDomainCount < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomainCount", 1); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.cs new file mode 100644 index 0000000000000..3a12166c20208 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.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.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class DedicatedHostGroupInstanceView + { + /// + /// Initializes a new instance of the DedicatedHostGroupInstanceView + /// class. + /// + public DedicatedHostGroupInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostGroupInstanceView + /// class. + /// + /// List of instance view of the dedicated hosts + /// under the dedicated host group. + public DedicatedHostGroupInstanceView(IList hosts = default(IList)) + { + Hosts = hosts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of instance view of the dedicated hosts under the + /// dedicated host group. + /// + [JsonProperty(PropertyName = "hosts")] + public IList Hosts { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs new file mode 100644 index 0000000000000..cdd31b9d1d48f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs @@ -0,0 +1,131 @@ +// +// 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 dedicated host group that the dedicated + /// host should be assigned to. Only tags may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHostGroupUpdate : UpdateResource + { + /// + /// Initializes a new instance of the DedicatedHostGroupUpdate class. + /// + public DedicatedHostGroupUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostGroupUpdate class. + /// + /// Number of fault domains that + /// the host group can span. + /// Resource tags + /// A list of references to all dedicated hosts in + /// the dedicated host group. + /// The dedicated host group instance view, + /// which has the list of instance view of the dedicated hosts under + /// the dedicated host group. + /// Specifies whether virtual + /// machines or virtual machine scale sets can be placed automatically + /// on the dedicated host group. Automatic placement means resources + /// are allocated on dedicated hosts, that are chosen by Azure, under + /// the dedicated host group. The value is defaulted to 'false' when + /// not provided. <br><br>Minimum api-version: + /// 2020-06-01. + /// Availability Zone to use for this host group. + /// Only single zone is supported. The zone can be assigned only during + /// creation. If not provided, the group supports all zones in the + /// region. If provided, enforces each host in the group to be in the + /// same zone. + public DedicatedHostGroupUpdate(int platformFaultDomainCount, IDictionary tags = default(IDictionary), IList hosts = default(IList), DedicatedHostGroupInstanceView instanceView = default(DedicatedHostGroupInstanceView), bool? supportAutomaticPlacement = default(bool?), IList zones = default(IList)) + : base(tags) + { + PlatformFaultDomainCount = platformFaultDomainCount; + Hosts = hosts; + InstanceView = instanceView; + SupportAutomaticPlacement = supportAutomaticPlacement; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of fault domains that the host group can span. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int PlatformFaultDomainCount { get; set; } + + /// + /// Gets a list of references to all dedicated hosts in the dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.hosts")] + public IList Hosts { get; private set; } + + /// + /// Gets the dedicated host group instance view, which has the list of + /// instance view of the dedicated hosts under the dedicated host + /// group. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostGroupInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets specifies whether virtual machines or virtual machine + /// scale sets can be placed automatically on the dedicated host group. + /// Automatic placement means resources are allocated on dedicated + /// hosts, that are chosen by Azure, under the dedicated host group. + /// The value is defaulted to 'false' when not provided. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "properties.supportAutomaticPlacement")] + public bool? SupportAutomaticPlacement { get; set; } + + /// + /// Gets or sets availability Zone to use for this host group. Only + /// single zone is supported. The zone can be assigned only during + /// creation. If not provided, the group supports all zones in the + /// region. If provided, enforces each host in the group to be in the + /// same zone. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PlatformFaultDomainCount < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomainCount", 1); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostInstanceView.cs new file mode 100644 index 0000000000000..6e25d0364b64a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostInstanceView.cs @@ -0,0 +1,72 @@ +// +// 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 a dedicated host. + /// + public partial class DedicatedHostInstanceView + { + /// + /// Initializes a new instance of the DedicatedHostInstanceView class. + /// + public DedicatedHostInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostInstanceView class. + /// + /// Specifies the unique id of the dedicated + /// physical machine on which the dedicated host resides. + /// Unutilized capacity of the + /// dedicated host. + /// The resource status information. + public DedicatedHostInstanceView(string assetId = default(string), DedicatedHostAvailableCapacity availableCapacity = default(DedicatedHostAvailableCapacity), IList statuses = default(IList)) + { + AssetId = assetId; + AvailableCapacity = availableCapacity; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the unique id of the dedicated physical machine on + /// which the dedicated host resides. + /// + [JsonProperty(PropertyName = "assetId")] + public string AssetId { get; private set; } + + /// + /// Gets or sets unutilized capacity of the dedicated host. + /// + [JsonProperty(PropertyName = "availableCapacity")] + public DedicatedHostAvailableCapacity AvailableCapacity { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.cs new file mode 100644 index 0000000000000..da90aa0c41e74 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.cs @@ -0,0 +1,63 @@ +// +// 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 a dedicated host that includes the name of the + /// dedicated host. It is used for the response to the instance view of a + /// dedicated host group. + /// + public partial class DedicatedHostInstanceViewWithName : DedicatedHostInstanceView + { + /// + /// Initializes a new instance of the DedicatedHostInstanceViewWithName + /// class. + /// + public DedicatedHostInstanceViewWithName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostInstanceViewWithName + /// class. + /// + /// Specifies the unique id of the dedicated + /// physical machine on which the dedicated host resides. + /// Unutilized capacity of the + /// dedicated host. + /// The resource status information. + /// The name of the dedicated host. + public DedicatedHostInstanceViewWithName(string assetId = default(string), DedicatedHostAvailableCapacity availableCapacity = default(DedicatedHostAvailableCapacity), IList statuses = default(IList), string name = default(string)) + : base(assetId, availableCapacity, statuses) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the dedicated host. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostLicenseTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostLicenseTypes.cs new file mode 100644 index 0000000000000..408c2b449d335 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostLicenseTypes.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DedicatedHostLicenseTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DedicatedHostLicenseTypes + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "Windows_Server_Hybrid")] + WindowsServerHybrid, + [EnumMember(Value = "Windows_Server_Perpetual")] + WindowsServerPerpetual + } + internal static class DedicatedHostLicenseTypesEnumExtension + { + internal static string ToSerializedValue(this DedicatedHostLicenseTypes? value) + { + return value == null ? null : ((DedicatedHostLicenseTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DedicatedHostLicenseTypes value) + { + switch( value ) + { + case DedicatedHostLicenseTypes.None: + return "None"; + case DedicatedHostLicenseTypes.WindowsServerHybrid: + return "Windows_Server_Hybrid"; + case DedicatedHostLicenseTypes.WindowsServerPerpetual: + return "Windows_Server_Perpetual"; + } + return null; + } + + internal static DedicatedHostLicenseTypes? ParseDedicatedHostLicenseTypes(this string value) + { + switch( value ) + { + case "None": + return DedicatedHostLicenseTypes.None; + case "Windows_Server_Hybrid": + return DedicatedHostLicenseTypes.WindowsServerHybrid; + case "Windows_Server_Perpetual": + return DedicatedHostLicenseTypes.WindowsServerPerpetual; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostUpdate.cs new file mode 100644 index 0000000000000..b49fbb5da1485 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostUpdate.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 dedicated host. Only tags, + /// autoReplaceOnFailure and licenseType may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHostUpdate : UpdateResource + { + /// + /// Initializes a new instance of the DedicatedHostUpdate class. + /// + public DedicatedHostUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostUpdate class. + /// + /// Resource tags + /// Fault domain of the dedicated + /// host within a dedicated host group. + /// Specifies whether the dedicated + /// host should be replaced automatically in case of a failure. The + /// value is defaulted to 'true' when not provided. + /// A unique id generated and assigned to the + /// dedicated host by the platform. <br><br> Does not + /// change throughout the lifetime of the host. + /// A list of references to all virtual + /// machines in the Dedicated Host. + /// Specifies the software license type that + /// will be applied to the VMs deployed on the dedicated host. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **Windows_Server_Hybrid** + /// <br><br> **Windows_Server_Perpetual** + /// <br><br> Default: **None**. Possible values include: + /// 'None', 'Windows_Server_Hybrid', 'Windows_Server_Perpetual' + /// The date when the host was first + /// provisioned. + /// The provisioning state, which only + /// appears in the response. + /// The dedicated host instance + /// view. + public DedicatedHostUpdate(IDictionary tags = default(IDictionary), int? platformFaultDomain = default(int?), bool? autoReplaceOnFailure = default(bool?), string hostId = default(string), IList virtualMachines = default(IList), DedicatedHostLicenseTypes? licenseType = default(DedicatedHostLicenseTypes?), System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), DedicatedHostInstanceView instanceView = default(DedicatedHostInstanceView)) + : base(tags) + { + PlatformFaultDomain = platformFaultDomain; + AutoReplaceOnFailure = autoReplaceOnFailure; + HostId = hostId; + VirtualMachines = virtualMachines; + LicenseType = licenseType; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fault domain of the dedicated host within a dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies whether the dedicated host should be + /// replaced automatically in case of a failure. The value is defaulted + /// to 'true' when not provided. + /// + [JsonProperty(PropertyName = "properties.autoReplaceOnFailure")] + public bool? AutoReplaceOnFailure { get; set; } + + /// + /// Gets a unique id generated and assigned to the dedicated host by + /// the platform. &lt;br&gt;&lt;br&gt; Does not change + /// throughout the lifetime of the host. + /// + [JsonProperty(PropertyName = "properties.hostId")] + public string HostId { get; private set; } + + /// + /// Gets a list of references to all virtual machines in the Dedicated + /// Host. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; private set; } + + /// + /// Gets or sets specifies the software license type that will be + /// applied to the VMs deployed on the dedicated host. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **Windows_Server_Hybrid** + /// &lt;br&gt;&lt;br&gt; **Windows_Server_Perpetual** + /// &lt;br&gt;&lt;br&gt; Default: **None**. Possible + /// values include: 'None', 'Windows_Server_Hybrid', + /// 'Windows_Server_Perpetual' + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public DedicatedHostLicenseTypes? LicenseType { get; set; } + + /// + /// Gets the date when the host was first provisioned. + /// + [JsonProperty(PropertyName = "properties.provisioningTime")] + public System.DateTime? ProvisioningTime { get; private set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the dedicated host instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostInstanceView InstanceView { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PlatformFaultDomain < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomain", 0); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiagnosticsProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiagnosticsProfile.cs new file mode 100644 index 0000000000000..655cd4d8304ec --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiagnosticsProfile.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the boot diagnostic settings state. + /// <br><br>Minimum api-version: 2015-06-15. + /// + public partial class DiagnosticsProfile + { + /// + /// Initializes a new instance of the DiagnosticsProfile class. + /// + public DiagnosticsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticsProfile class. + /// + /// Boot Diagnostics is a debugging + /// feature which allows you to view Console Output and Screenshot to + /// diagnose VM status. <br><br> You can easily view the + /// output of your console log. <br><br> Azure also enables + /// you to see a screenshot of the VM from the hypervisor. + public DiagnosticsProfile(BootDiagnostics bootDiagnostics = default(BootDiagnostics)) + { + BootDiagnostics = bootDiagnostics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets boot Diagnostics is a debugging feature which allows + /// you to view Console Output and Screenshot to diagnose VM status. + /// &lt;br&gt;&lt;br&gt; You can easily view the output + /// of your console log. &lt;br&gt;&lt;br&gt; Azure + /// also enables you to see a screenshot of the VM from the hypervisor. + /// + [JsonProperty(PropertyName = "bootDiagnostics")] + public BootDiagnostics BootDiagnostics { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskOptions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskOptions.cs new file mode 100644 index 0000000000000..09c09a620cb37 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskOptions.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 DiffDiskOptions. + /// + public static class DiffDiskOptions + { + public const string Local = "Local"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskPlacement.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskPlacement.cs new file mode 100644 index 0000000000000..1ce5df37dc9ea --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskPlacement.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 DiffDiskPlacement. + /// + public static class DiffDiskPlacement + { + public const string CacheDisk = "CacheDisk"; + public const string ResourceDisk = "ResourceDisk"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskSettings.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskSettings.cs new file mode 100644 index 0000000000000..8655f8dc7d782 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiffDiskSettings.cs @@ -0,0 +1,86 @@ +// +// 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 parameters of ephemeral disk settings that can be + /// specified for operating system disk. <br><br> NOTE: The + /// ephemeral disk settings can only be specified for managed disk. + /// + public partial class DiffDiskSettings + { + /// + /// Initializes a new instance of the DiffDiskSettings class. + /// + public DiffDiskSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiffDiskSettings class. + /// + /// Specifies the ephemeral disk settings for + /// operating system disk. Possible values include: 'Local' + /// Specifies the ephemeral disk placement for + /// operating system disk.<br><br> Possible values are: + /// <br><br> **CacheDisk** <br><br> + /// **ResourceDisk** <br><br> Default: **CacheDisk** if one + /// is configured for the VM size otherwise **ResourceDisk** is + /// used.<br><br> Refer to VM size documentation for + /// Windows VM at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes + /// and Linux VM at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes + /// to check which VM sizes exposes a cache disk. Possible values + /// include: 'CacheDisk', 'ResourceDisk' + public DiffDiskSettings(string option = default(string), string placement = default(string)) + { + Option = option; + Placement = placement; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the ephemeral disk settings for operating + /// system disk. Possible values include: 'Local' + /// + [JsonProperty(PropertyName = "option")] + public string Option { get; set; } + + /// + /// Gets or sets specifies the ephemeral disk placement for operating + /// system disk.&lt;br&gt;&lt;br&gt; Possible values + /// are: &lt;br&gt;&lt;br&gt; **CacheDisk** + /// &lt;br&gt;&lt;br&gt; **ResourceDisk** + /// &lt;br&gt;&lt;br&gt; Default: **CacheDisk** if one + /// is configured for the VM size otherwise **ResourceDisk** is + /// used.&lt;br&gt;&lt;br&gt; Refer to VM size + /// documentation for Windows VM at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes + /// and Linux VM at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes + /// to check which VM sizes exposes a cache disk. Possible values + /// include: 'CacheDisk', 'ResourceDisk' + /// + [JsonProperty(PropertyName = "placement")] + public string Placement { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disallowed.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disallowed.cs new file mode 100644 index 0000000000000..19df1e2832809 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disallowed.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 disallowed disk types. + /// + public partial class Disallowed + { + /// + /// Initializes a new instance of the Disallowed class. + /// + public Disallowed() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Disallowed class. + /// + /// A list of disk types. + public Disallowed(IList diskTypes = default(IList)) + { + DiskTypes = diskTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of disk types. + /// + [JsonProperty(PropertyName = "diskTypes")] + public IList DiskTypes { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DisallowedConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DisallowedConfiguration.cs new file mode 100644 index 0000000000000..cc640a3e69dbc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DisallowedConfiguration.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.Linq; + + /// + /// Specifies the disallowed configuration for a virtual machine image. + /// + public partial class DisallowedConfiguration + { + /// + /// Initializes a new instance of the DisallowedConfiguration class. + /// + public DisallowedConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DisallowedConfiguration class. + /// + /// VM disk types which are disallowed. + /// Possible values include: 'None', 'Unmanaged' + public DisallowedConfiguration(string vmDiskType = default(string)) + { + VmDiskType = vmDiskType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets VM disk types which are disallowed. Possible values + /// include: 'None', 'Unmanaged' + /// + [JsonProperty(PropertyName = "vmDiskType")] + public string VmDiskType { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs new file mode 100644 index 0000000000000..821733405d0d5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs @@ -0,0 +1,342 @@ +// +// 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; + + /// + /// Disk resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class Disk : Resource + { + /// + /// Initializes a new instance of the Disk class. + /// + public Disk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Disk class. + /// + /// Resource location + /// Disk source information. CreationData + /// information cannot be changed after the disk has been + /// created. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A relative URI containing the ID of the VM + /// that has the disk attached. + /// List of relative URIs containing + /// the IDs of the VMs that have the disk attached. maxShares should be + /// set to a value greater than one for disks to allow attaching them + /// to multiple VMs. + /// The Logical zone list for Disk. + /// The time when the disk was + /// created. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// The size of the disk in bytes. This + /// field is read only. + /// Unique Guid identifying the + /// resource. + /// Encryption settings + /// collection used for Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The disk provisioning + /// state. + /// The number of IOPS allowed for this + /// disk; only settable for UltraSSD disks. One operation can transfer + /// between 4k and 256k bytes. + /// The bandwidth allowed for this + /// disk; only settable for UltraSSD disks. MBps means millions of + /// bytes per second - MB here uses the ISO notation, of powers of + /// 10. + /// The total number of IOPS that will + /// be allowed across all VMs mounting the shared disk as ReadOnly. One + /// operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that + /// will be allowed across all VMs mounting the shared disk as + /// ReadOnly. MBps means millions of bytes per second - MB here uses + /// the ISO notation, of powers of 10. + /// The state of the disk. Possible values + /// include: 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', + /// 'ReadyToUpload', 'ActiveUpload' + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// The maximum number of VMs that can attach + /// to the disk at the same time. Value greater than one indicates a + /// disk that can be mounted on multiple VMs at the same time. + /// Details of the list of all VMs that have + /// the disk attached. maxShares should be set to a value greater than + /// one for disks to allow attaching them to multiple VMs. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + public Disk(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), IList managedByExtended = default(IList), DiskSku sku = default(DiskSku), IList zones = default(IList), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), long? diskIOPSReadOnly = default(long?), long? diskMBpsReadOnly = default(long?), string diskState = default(string), Encryption encryption = default(Encryption), int? maxShares = default(int?), IList shareInfo = default(IList), string networkAccessPolicy = default(string), string diskAccessId = default(string), string tier = default(string)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + ManagedByExtended = managedByExtended; + Sku = sku; + Zones = zones; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + DiskState = diskState; + Encryption = encryption; + MaxShares = maxShares; + ShareInfo = shareInfo; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a relative URI containing the ID of the VM that has the disk + /// attached. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; private set; } + + /// + /// Gets list of relative URIs containing the IDs of the VMs that have + /// the disk attached. maxShares should be set to a value greater than + /// one for disks to allow attaching them to multiple VMs. + /// + [JsonProperty(PropertyName = "managedByExtended")] + public IList ManagedByExtended { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public DiskSku Sku { get; set; } + + /// + /// Gets or sets the Logical zone list for Disk. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets the time when the disk was created. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { 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 disk source information. CreationData information + /// cannot be changed after the disk has been created. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets the size of the disk in bytes. This field is read only. + /// + [JsonProperty(PropertyName = "properties.diskSizeBytes")] + public long? DiskSizeBytes { get; private set; } + + /// + /// Gets unique Guid identifying the resource. + /// + [JsonProperty(PropertyName = "properties.uniqueId")] + public string UniqueId { get; private set; } + + /// + /// Gets or sets encryption settings collection used for Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets the disk provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the number of IOPS allowed for this disk; only + /// settable for UltraSSD disks. One operation can transfer between 4k + /// and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; set; } + + /// + /// Gets or sets the bandwidth allowed for this disk; only settable for + /// UltraSSD disks. MBps means millions of bytes per second - MB here + /// uses the ISO notation, of powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + + /// + /// Gets or sets the total number of IOPS that will be allowed across + /// all VMs mounting the shared disk as ReadOnly. One operation can + /// transfer between 4k and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadOnly")] + public long? DiskIOPSReadOnly { get; set; } + + /// + /// Gets or sets the total throughput (MBps) that will be allowed + /// across all VMs mounting the shared disk as ReadOnly. MBps means + /// millions of bytes per second - MB here uses the ISO notation, of + /// powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadOnly")] + public long? DiskMBpsReadOnly { get; set; } + + /// + /// Gets or sets the state of the disk. Possible values include: + /// 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', + /// 'ActiveUpload' + /// + [JsonProperty(PropertyName = "properties.diskState")] + public string DiskState { get; set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets the maximum number of VMs that can attach to the disk + /// at the same time. Value greater than one indicates a disk that can + /// be mounted on multiple VMs at the same time. + /// + [JsonProperty(PropertyName = "properties.maxShares")] + public int? MaxShares { get; set; } + + /// + /// Gets details of the list of all VMs that have the disk attached. + /// maxShares should be set to a value greater than one for disks to + /// allow attaching them to multiple VMs. + /// + [JsonProperty(PropertyName = "properties.shareInfo")] + public IList ShareInfo { get; private set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets or sets performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// + [JsonProperty(PropertyName = "properties.tier")] + public string Tier { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CreationData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreationData"); + } + if (CreationData != null) + { + CreationData.Validate(); + } + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccess.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccess.cs new file mode 100644 index 0000000000000..f16592d89dba8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccess.cs @@ -0,0 +1,103 @@ +// +// 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; + + /// + /// disk access resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskAccess : Resource + { + /// + /// Initializes a new instance of the DiskAccess class. + /// + public DiskAccess() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskAccess class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A readonly collection of + /// private endpoint connections created on the disk. Currently only + /// one endpoint connection is supported. + /// The disk access resource + /// provisioning state. + /// The time when the disk access was + /// created. + public DiskAccess(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList privateEndpointConnections = default(IList), string provisioningState = default(string), System.DateTime? timeCreated = default(System.DateTime?)) + : base(location, id, name, type, tags) + { + PrivateEndpointConnections = privateEndpointConnections; + ProvisioningState = provisioningState; + TimeCreated = timeCreated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a readonly collection of private endpoint connections created + /// on the disk. Currently only one endpoint connection is supported. + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + + /// + /// Gets the disk access resource provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the time when the disk access was created. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccessUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccessUpdate.cs new file mode 100644 index 0000000000000..eb626405e5bb0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccessUpdate.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; + + /// + /// Used for updating a disk access resource. + /// + public partial class DiskAccessUpdate + { + /// + /// Initializes a new instance of the DiskAccessUpdate class. + /// + public DiskAccessUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskAccessUpdate class. + /// + /// Resource tags + public DiskAccessUpdate(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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskCreateOption.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskCreateOption.cs new file mode 100644 index 0000000000000..ce7b658a0f0db --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskCreateOption.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 +{ + + /// + /// Defines values for DiskCreateOption. + /// + public static class DiskCreateOption + { + /// + /// Create an empty data disk of a size given by diskSizeGB. + /// + public const string Empty = "Empty"; + /// + /// Disk will be attached to a VM. + /// + public const string Attach = "Attach"; + /// + /// Create a new disk from a platform image specified by the given + /// imageReference or galleryImageReference. + /// + public const string FromImage = "FromImage"; + /// + /// Create a disk by importing from a blob specified by a sourceUri in + /// a storage account specified by storageAccountId. + /// + public const string Import = "Import"; + /// + /// Create a new disk or snapshot by copying from a disk or snapshot + /// specified by the given sourceResourceId. + /// + public const string Copy = "Copy"; + /// + /// Create a new disk by copying from a backup recovery point. + /// + public const string Restore = "Restore"; + /// + /// Create a new disk by obtaining a write token and using it to + /// directly upload the contents of the disk. + /// + public const string Upload = "Upload"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskCreateOptionTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskCreateOptionTypes.cs new file mode 100644 index 0000000000000..6540322a76233 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskCreateOptionTypes.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 DiskCreateOptionTypes. + /// + public static class DiskCreateOptionTypes + { + public const string FromImage = "FromImage"; + public const string Empty = "Empty"; + public const string Attach = "Attach"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskDetachOptionTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskDetachOptionTypes.cs new file mode 100644 index 0000000000000..9244426d7ec0f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskDetachOptionTypes.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 DiskDetachOptionTypes. + /// + public static class DiskDetachOptionTypes + { + public const string ForceDetach = "ForceDetach"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs new file mode 100644 index 0000000000000..5c025434c3d48 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs @@ -0,0 +1,128 @@ +// +// 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; + + /// + /// disk encryption set resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskEncryptionSet : Resource + { + /// + /// Initializes a new instance of the DiskEncryptionSet class. + /// + public DiskEncryptionSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// The key vault key which is currently used + /// by this disk encryption set. + /// A readonly collection of key vault keys + /// previously used by this disk encryption set while a key rotation is + /// in progress. It will be empty if there is no ongoing key + /// rotation. + /// The disk encryption set + /// provisioning state. + public DiskEncryptionSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), EncryptionSetIdentity identity = default(EncryptionSetIdentity), string encryptionType = default(string), KeyVaultAndKeyReference activeKey = default(KeyVaultAndKeyReference), IList previousKeys = default(IList), string provisioningState = default(string)) + : base(location, id, name, type, tags) + { + Identity = identity; + EncryptionType = encryptionType; + ActiveKey = activeKey; + PreviousKeys = previousKeys; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public EncryptionSetIdentity Identity { get; set; } + + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// + [JsonProperty(PropertyName = "properties.encryptionType")] + public string EncryptionType { get; set; } + + /// + /// Gets or sets the key vault key which is currently used by this disk + /// encryption set. + /// + [JsonProperty(PropertyName = "properties.activeKey")] + public KeyVaultAndKeyReference ActiveKey { get; set; } + + /// + /// Gets a readonly collection of key vault keys previously used by + /// this disk encryption set while a key rotation is in progress. It + /// will be empty if there is no ongoing key rotation. + /// + [JsonProperty(PropertyName = "properties.previousKeys")] + public IList PreviousKeys { get; private set; } + + /// + /// Gets the disk encryption set provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (ActiveKey != null) + { + ActiveKey.Validate(); + } + if (PreviousKeys != null) + { + foreach (var element in PreviousKeys) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetIdentityType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetIdentityType.cs new file mode 100644 index 0000000000000..1e465b702f023 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetIdentityType.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 DiskEncryptionSetIdentityType. + /// + public static class DiskEncryptionSetIdentityType + { + public const string SystemAssigned = "SystemAssigned"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs new file mode 100644 index 0000000000000..c8a6508b3b79e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetParameters.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 System.Linq; + + /// + /// Describes the parameter of customer managed disk encryption set + /// resource id that can be specified for disk. <br><br> NOTE: + /// The disk encryption set resource id can only be specified for managed + /// disk. Please refer https://aka.ms/mdssewithcmkoverview for more + /// details. + /// + public partial class DiskEncryptionSetParameters : SubResource + { + /// + /// Initializes a new instance of the DiskEncryptionSetParameters + /// class. + /// + public DiskEncryptionSetParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSetParameters + /// class. + /// + /// Resource Id + public DiskEncryptionSetParameters(string id = default(string)) + : base(id) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetType.cs new file mode 100644 index 0000000000000..dcb4cb47d4807 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetType.cs @@ -0,0 +1,31 @@ +// +// 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 DiskEncryptionSetType. + /// + public static class DiskEncryptionSetType + { + /// + /// Resource using diskEncryptionSet would be encrypted at rest with + /// Customer managed key that can be changed and revoked by a customer. + /// + public const string EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey"; + /// + /// Resource using diskEncryptionSet would be encrypted at rest with + /// two layers of encryption. One of the keys is Customer managed and + /// the other key is Platform managed. + /// + public const string EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetUpdate.cs new file mode 100644 index 0000000000000..b6d8424ba4355 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetUpdate.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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// disk encryption set update resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskEncryptionSetUpdate + { + /// + /// Initializes a new instance of the DiskEncryptionSetUpdate class. + /// + public DiskEncryptionSetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSetUpdate class. + /// + /// Possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// Resource tags + public DiskEncryptionSetUpdate(string encryptionType = default(string), KeyVaultAndKeyReference activeKey = default(KeyVaultAndKeyReference), IDictionary tags = default(IDictionary)) + { + EncryptionType = encryptionType; + ActiveKey = activeKey; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// + [JsonProperty(PropertyName = "properties.encryptionType")] + public string EncryptionType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.activeKey")] + public KeyVaultAndKeyReference ActiveKey { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ActiveKey != null) + { + ActiveKey.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSettings.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSettings.cs new file mode 100644 index 0000000000000..b12e55e04b9e4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSettings.cs @@ -0,0 +1,90 @@ +// +// 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 Encryption Settings for a Disk + /// + public partial class DiskEncryptionSettings + { + /// + /// Initializes a new instance of the DiskEncryptionSettings class. + /// + public DiskEncryptionSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSettings class. + /// + /// Specifies the location of the disk + /// encryption key, which is a Key Vault Secret. + /// Specifies the location of the key + /// encryption key in Key Vault. + /// Specifies whether disk encryption should be + /// enabled on the virtual machine. + public DiskEncryptionSettings(KeyVaultSecretReference diskEncryptionKey = default(KeyVaultSecretReference), KeyVaultKeyReference keyEncryptionKey = default(KeyVaultKeyReference), bool? enabled = default(bool?)) + { + DiskEncryptionKey = diskEncryptionKey; + KeyEncryptionKey = keyEncryptionKey; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the location of the disk encryption key, + /// which is a Key Vault Secret. + /// + [JsonProperty(PropertyName = "diskEncryptionKey")] + public KeyVaultSecretReference DiskEncryptionKey { get; set; } + + /// + /// Gets or sets specifies the location of the key encryption key in + /// Key Vault. + /// + [JsonProperty(PropertyName = "keyEncryptionKey")] + public KeyVaultKeyReference KeyEncryptionKey { get; set; } + + /// + /// Gets or sets specifies whether disk encryption should be enabled on + /// the virtual machine. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DiskEncryptionKey != null) + { + DiskEncryptionKey.Validate(); + } + if (KeyEncryptionKey != null) + { + KeyEncryptionKey.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskImageEncryption.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskImageEncryption.cs new file mode 100644 index 0000000000000..ce3330d1cfc7a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskImageEncryption.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.Linq; + + /// + /// This is the disk image encryption base class. + /// + public partial class DiskImageEncryption + { + /// + /// Initializes a new instance of the DiskImageEncryption class. + /// + public DiskImageEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskImageEncryption class. + /// + /// A relative URI containing the + /// resource ID of the disk encryption set. + public DiskImageEncryption(string diskEncryptionSetId = default(string)) + { + DiskEncryptionSetId = diskEncryptionSetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a relative URI containing the resource ID of the disk + /// encryption set. + /// + [JsonProperty(PropertyName = "diskEncryptionSetId")] + public string DiskEncryptionSetId { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskInstanceView.cs new file mode 100644 index 0000000000000..a1a45d7a1d234 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskInstanceView.cs @@ -0,0 +1,73 @@ +// +// 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 disk. + /// + public partial class DiskInstanceView + { + /// + /// Initializes a new instance of the DiskInstanceView class. + /// + public DiskInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskInstanceView class. + /// + /// The disk name. + /// Specifies the encryption settings + /// for the OS Disk. <br><br> Minimum api-version: + /// 2015-06-15 + /// The resource status information. + public DiskInstanceView(string name = default(string), IList encryptionSettings = default(IList), IList statuses = default(IList)) + { + Name = name; + EncryptionSettings = encryptionSettings; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the encryption settings for the OS Disk. + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "encryptionSettings")] + public IList EncryptionSettings { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskSku.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskSku.cs new file mode 100644 index 0000000000000..d78c8a6086b55 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskSku.cs @@ -0,0 +1,63 @@ +// +// 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 disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + /// or UltraSSD_LRS. + /// + public partial class DiskSku + { + /// + /// Initializes a new instance of the DiskSku class. + /// + public DiskSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskSku class. + /// + /// The sku name. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// The sku tier. + public DiskSku(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 or sets the sku name. Possible values include: 'Standard_LRS', + /// 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets the sku tier. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskState.cs new file mode 100644 index 0000000000000..a9e6e3803281c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskState.cs @@ -0,0 +1,46 @@ +// +// 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 DiskState. + /// + public static class DiskState + { + /// + /// The disk is not being used and can be attached to a VM. + /// + public const string Unattached = "Unattached"; + /// + /// The disk is currently mounted to a running VM. + /// + public const string Attached = "Attached"; + /// + /// The disk is mounted to a stopped-deallocated VM + /// + public const string Reserved = "Reserved"; + /// + /// The disk currently has an Active SAS Uri associated with it. + /// + public const string ActiveSAS = "ActiveSAS"; + /// + /// A disk is ready to be created by upload by requesting a write + /// token. + /// + public const string ReadyToUpload = "ReadyToUpload"; + /// + /// A disk is created for upload and a write token has been issued for + /// uploading to it. + /// + public const string ActiveUpload = "ActiveUpload"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskStorageAccountTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskStorageAccountTypes.cs new file mode 100644 index 0000000000000..56c9935fdea32 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskStorageAccountTypes.cs @@ -0,0 +1,41 @@ +// +// 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 DiskStorageAccountTypes. + /// + public static class DiskStorageAccountTypes + { + /// + /// Standard HDD locally redundant storage. Best for backup, + /// non-critical, and infrequent access. + /// + public const string StandardLRS = "Standard_LRS"; + /// + /// Premium SSD locally redundant storage. Best for production and + /// performance sensitive workloads. + /// + public const string PremiumLRS = "Premium_LRS"; + /// + /// Standard SSD locally redundant storage. Best for web servers, + /// lightly used enterprise applications and dev/test. + /// + public const string StandardSSDLRS = "StandardSSD_LRS"; + /// + /// Ultra SSD locally redundant storage. Best for IO-intensive + /// workloads such as SAP HANA, top tier databases (for example, SQL, + /// Oracle), and other transaction-heavy workloads. + /// + public const string UltraSSDLRS = "UltraSSD_LRS"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskUpdate.cs new file mode 100644 index 0000000000000..c63cd3cd4a7b2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskUpdate.cs @@ -0,0 +1,222 @@ +// +// 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; + + /// + /// Disk update resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskUpdate + { + /// + /// Initializes a new instance of the DiskUpdate class. + /// + public DiskUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskUpdate class. + /// + /// the Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The number of IOPS allowed for this + /// disk; only settable for UltraSSD disks. One operation can transfer + /// between 4k and 256k bytes. + /// The bandwidth allowed for this + /// disk; only settable for UltraSSD disks. MBps means millions of + /// bytes per second - MB here uses the ISO notation, of powers of + /// 10. + /// The total number of IOPS that will + /// be allowed across all VMs mounting the shared disk as ReadOnly. One + /// operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that + /// will be allowed across all VMs mounting the shared disk as + /// ReadOnly. MBps means millions of bytes per second - MB here uses + /// the ISO notation, of powers of 10. + /// The maximum number of VMs that can attach + /// to the disk at the same time. Value greater than one indicates a + /// disk that can be mounted on multiple VMs at the same time. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// Resource tags + public DiskUpdate(OperatingSystemTypes? osType = default(OperatingSystemTypes?), int? diskSizeGB = default(int?), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), long? diskIOPSReadOnly = default(long?), long? diskMBpsReadOnly = default(long?), int? maxShares = default(int?), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), string tier = default(string), IDictionary tags = default(IDictionary), DiskSku sku = default(DiskSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + Tags = tags; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets encryption settings collection used be Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets or sets the number of IOPS allowed for this disk; only + /// settable for UltraSSD disks. One operation can transfer between 4k + /// and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; set; } + + /// + /// Gets or sets the bandwidth allowed for this disk; only settable for + /// UltraSSD disks. MBps means millions of bytes per second - MB here + /// uses the ISO notation, of powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + + /// + /// Gets or sets the total number of IOPS that will be allowed across + /// all VMs mounting the shared disk as ReadOnly. One operation can + /// transfer between 4k and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadOnly")] + public long? DiskIOPSReadOnly { get; set; } + + /// + /// Gets or sets the total throughput (MBps) that will be allowed + /// across all VMs mounting the shared disk as ReadOnly. MBps means + /// millions of bytes per second - MB here uses the ISO notation, of + /// powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadOnly")] + public long? DiskMBpsReadOnly { get; set; } + + /// + /// Gets or sets the maximum number of VMs that can attach to the disk + /// at the same time. Value greater than one indicates a disk that can + /// be mounted on multiple VMs at the same time. + /// + [JsonProperty(PropertyName = "properties.maxShares")] + public int? MaxShares { get; set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets or sets performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// + [JsonProperty(PropertyName = "properties.tier")] + public string Tier { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public DiskSku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs new file mode 100644 index 0000000000000..345dec01e4c3a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.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; + + /// + /// Encryption at rest settings for disk or snapshot + /// + public partial class Encryption + { + /// + /// Initializes a new instance of the Encryption class. + /// + public Encryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Encryption class. + /// + /// ResourceId of the disk encryption + /// set to use for enabling encryption at rest. + /// Possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + public Encryption(string diskEncryptionSetId = default(string), string type = default(string)) + { + DiskEncryptionSetId = diskEncryptionSetId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resourceId of the disk encryption set to use for + /// enabling encryption at rest. + /// + [JsonProperty(PropertyName = "diskEncryptionSetId")] + public string DiskEncryptionSetId { get; set; } + + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionImages.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionImages.cs new file mode 100644 index 0000000000000..de2b2529bdfe5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionImages.cs @@ -0,0 +1,62 @@ +// +// 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; + + /// + /// Optional. Allows users to provide customer managed keys for encrypting + /// the OS and data disks in the gallery artifact. + /// + public partial class EncryptionImages + { + /// + /// Initializes a new instance of the EncryptionImages class. + /// + public EncryptionImages() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionImages class. + /// + /// A list of encryption specifications + /// for data disk images. + public EncryptionImages(OSDiskImageEncryption osDiskImage = default(OSDiskImageEncryption), IList dataDiskImages = default(IList)) + { + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "osDiskImage")] + public OSDiskImageEncryption OsDiskImage { get; set; } + + /// + /// Gets or sets a list of encryption specifications for data disk + /// images. + /// + [JsonProperty(PropertyName = "dataDiskImages")] + public IList DataDiskImages { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSetIdentity.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSetIdentity.cs new file mode 100644 index 0000000000000..b05d0d5faf0d0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSetIdentity.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.Linq; + + /// + /// The managed identity for the disk encryption set. It should be given + /// permission on the key vault before it can be used to encrypt disks. + /// + public partial class EncryptionSetIdentity + { + /// + /// Initializes a new instance of the EncryptionSetIdentity class. + /// + public EncryptionSetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionSetIdentity class. + /// + /// The type of Managed Identity used by the + /// DiskEncryptionSet. Only SystemAssigned is supported. Possible + /// values include: 'SystemAssigned' + /// The object id of the Managed Identity + /// Resource. This will be sent to the RP from ARM via the + /// x-ms-identity-principal-id header in the PUT request if the + /// resource has a systemAssigned(implicit) identity + /// The tenant id of the Managed Identity + /// Resource. This will be sent to the RP from ARM via the + /// x-ms-client-tenant-id header in the PUT request if the resource has + /// a systemAssigned(implicit) identity + public EncryptionSetIdentity(string type = default(string), string principalId = default(string), string tenantId = default(string)) + { + Type = type; + PrincipalId = principalId; + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of Managed Identity used by the + /// DiskEncryptionSet. Only SystemAssigned is supported. Possible + /// values include: 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets the object id of the Managed Identity Resource. This will be + /// sent to the RP from ARM via the x-ms-identity-principal-id header + /// in the PUT request if the resource has a systemAssigned(implicit) + /// identity + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id of the Managed Identity Resource. This will be + /// sent to the RP from ARM via the x-ms-client-tenant-id header in the + /// PUT request if the resource has a systemAssigned(implicit) identity + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSettingsCollection.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSettingsCollection.cs new file mode 100644 index 0000000000000..3e942e2731b7b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSettingsCollection.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Encryption settings for disk or snapshot + /// + public partial class EncryptionSettingsCollection + { + /// + /// Initializes a new instance of the EncryptionSettingsCollection + /// class. + /// + public EncryptionSettingsCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionSettingsCollection + /// class. + /// + /// Set this flag to true and provide + /// DiskEncryptionKey and optional KeyEncryptionKey to enable + /// encryption. Set this flag to false and remove DiskEncryptionKey and + /// KeyEncryptionKey to disable encryption. If EncryptionSettings is + /// null in the request object, the existing settings remain + /// unchanged. + /// A collection of encryption + /// settings, one for each disk volume. + /// Describes what type of + /// encryption is used for the disks. Once this field is set, it cannot + /// be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD + /// app.'1.1' corresponds to Azure Disk Encryption. + public EncryptionSettingsCollection(bool enabled, IList encryptionSettings = default(IList), string encryptionSettingsVersion = default(string)) + { + Enabled = enabled; + EncryptionSettings = encryptionSettings; + EncryptionSettingsVersion = encryptionSettingsVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets set this flag to true and provide DiskEncryptionKey + /// and optional KeyEncryptionKey to enable encryption. Set this flag + /// to false and remove DiskEncryptionKey and KeyEncryptionKey to + /// disable encryption. If EncryptionSettings is null in the request + /// object, the existing settings remain unchanged. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets a collection of encryption settings, one for each disk + /// volume. + /// + [JsonProperty(PropertyName = "encryptionSettings")] + public IList EncryptionSettings { get; set; } + + /// + /// Gets or sets describes what type of encryption is used for the + /// disks. Once this field is set, it cannot be overwritten. '1.0' + /// corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds + /// to Azure Disk Encryption. + /// + [JsonProperty(PropertyName = "encryptionSettingsVersion")] + public string EncryptionSettingsVersion { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EncryptionSettings != null) + { + foreach (var element in EncryptionSettings) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSettingsElement.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSettingsElement.cs new file mode 100644 index 0000000000000..074af2eb92f06 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionSettingsElement.cs @@ -0,0 +1,82 @@ +// +// 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; + + /// + /// Encryption settings for one disk volume. + /// + public partial class EncryptionSettingsElement + { + /// + /// Initializes a new instance of the EncryptionSettingsElement class. + /// + public EncryptionSettingsElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionSettingsElement class. + /// + /// Key Vault Secret Url and vault id + /// of the disk encryption key + /// Key Vault Key Url and vault id of + /// the key encryption key. KeyEncryptionKey is optional and when + /// provided is used to unwrap the disk encryption key. + public EncryptionSettingsElement(KeyVaultAndSecretReference diskEncryptionKey = default(KeyVaultAndSecretReference), KeyVaultAndKeyReference keyEncryptionKey = default(KeyVaultAndKeyReference)) + { + DiskEncryptionKey = diskEncryptionKey; + KeyEncryptionKey = keyEncryptionKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets key Vault Secret Url and vault id of the disk + /// encryption key + /// + [JsonProperty(PropertyName = "diskEncryptionKey")] + public KeyVaultAndSecretReference DiskEncryptionKey { get; set; } + + /// + /// Gets or sets key Vault Key Url and vault id of the key encryption + /// key. KeyEncryptionKey is optional and when provided is used to + /// unwrap the disk encryption key. + /// + [JsonProperty(PropertyName = "keyEncryptionKey")] + public KeyVaultAndKeyReference KeyEncryptionKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DiskEncryptionKey != null) + { + DiskEncryptionKey.Validate(); + } + if (KeyEncryptionKey != null) + { + KeyEncryptionKey.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs new file mode 100644 index 0000000000000..fd806754ff4e3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs @@ -0,0 +1,36 @@ +// +// 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 EncryptionType. + /// + public static class EncryptionType + { + /// + /// Disk is encrypted at rest with Platform managed key. It is the + /// default encryption type. This is not a valid encryption type for + /// disk encryption sets. + /// + public const string EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey"; + /// + /// Disk is encrypted at rest with Customer managed key that can be + /// changed and revoked by a customer. + /// + public const string EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey"; + /// + /// Disk is encrypted at rest with 2 layers of encryption. One of the + /// keys is Customer managed and the other key is Platform managed. + /// + public const string EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocation.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocation.cs new file mode 100644 index 0000000000000..5e8cf1371fd0b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocation.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ExtendedLocation complex type. + /// + public partial class ExtendedLocation + { + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + public ExtendedLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + /// The name of the extended location. + public ExtendedLocation(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for ExtendedLocation class. + /// + static ExtendedLocation() + { + Type = "EdgeZone"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extended location. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The type of the extended location. + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocationTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocationTypes.cs new file mode 100644 index 0000000000000..77e0b2c669588 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocationTypes.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 ExtendedLocationTypes. + /// + public static class ExtendedLocationTypes + { + public const string EdgeZone = "EdgeZone"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Gallery.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Gallery.cs new file mode 100644 index 0000000000000..df6b6a84056c6 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Gallery.cs @@ -0,0 +1,101 @@ +// +// 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 Shared Image Gallery that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class Gallery : Resource + { + /// + /// Initializes a new instance of the Gallery class. + /// + public Gallery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Gallery class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this Shared Image + /// 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), SharingProfile sharingProfile = default(SharingProfile)) + : base(location, id, name, type, tags) + { + Description = description; + Identifier = identifier; + ProvisioningState = provisioningState; + SharingProfile = sharingProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this Shared Image Gallery resource. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryIdentifier Identifier { get; set; } + + /// + /// Gets the current state of the gallery. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.sharingProfile")] + public SharingProfile SharingProfile { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplication.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplication.cs new file mode 100644 index 0000000000000..b491fe0fabb24 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplication.cs @@ -0,0 +1,132 @@ +// +// 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 Application Definition that you + /// want to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplication : Resource + { + /// + /// Initializes a new instance of the GalleryApplication class. + /// + public GalleryApplication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplication class. + /// + /// Resource location + /// This property allows you to specify + /// the supported type of the OS that application is built for. + /// <br><br> Possible values are: <br><br> + /// **Windows** <br><br> **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this gallery + /// Application Definition resource. This property is + /// updatable. + /// The Eula agreement for the gallery Application + /// Definition. + /// The privacy statement + /// uri. + /// The release note uri. + /// The end of life date of the gallery + /// Application Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + public GalleryApplication(string location, OperatingSystemTypes supportedOSType, 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), System.DateTime? endOfLifeDate = default(System.DateTime?)) + : base(location, id, name, type, tags) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + EndOfLifeDate = endOfLifeDate; + SupportedOSType = supportedOSType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this gallery Application Definition + /// resource. This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Eula agreement for the gallery Application + /// Definition. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// Gets or sets the end of life date of the gallery Application + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets this property allows you to specify the supported type + /// of the OS that application is built for. + /// &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.supportedOSType")] + public OperatingSystemTypes SupportedOSType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationUpdate.cs new file mode 100644 index 0000000000000..0e9d84805aeb1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationUpdate.cs @@ -0,0 +1,130 @@ +// +// 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 Application Definition that you + /// want to update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplicationUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryApplicationUpdate class. + /// + public GalleryApplicationUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplicationUpdate class. + /// + /// This property allows you to specify + /// the supported type of the OS that application is built for. + /// <br><br> Possible values are: <br><br> + /// **Windows** <br><br> **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this gallery + /// Application Definition resource. This property is + /// updatable. + /// The Eula agreement for the gallery Application + /// Definition. + /// The privacy statement + /// uri. + /// The release note uri. + /// The end of life date of the gallery + /// Application Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + public GalleryApplicationUpdate(OperatingSystemTypes supportedOSType, 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), System.DateTime? endOfLifeDate = default(System.DateTime?)) + : base(id, name, type, tags) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + EndOfLifeDate = endOfLifeDate; + SupportedOSType = supportedOSType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this gallery Application Definition + /// resource. This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Eula agreement for the gallery Application + /// Definition. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// Gets or sets the end of life date of the gallery Application + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets this property allows you to specify the supported type + /// of the OS that application is built for. + /// &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.supportedOSType")] + public OperatingSystemTypes SupportedOSType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersion.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersion.cs new file mode 100644 index 0000000000000..b9d3829da9510 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersion.cs @@ -0,0 +1,99 @@ +// +// 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 Application Version that you + /// want to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplicationVersion : Resource + { + /// + /// Initializes a new instance of the GalleryApplicationVersion class. + /// + public GalleryApplicationVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplicationVersion class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The current state of the gallery + /// Application Version. + public GalleryApplicationVersion(string location, GalleryApplicationVersionPublishingProfile publishingProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(location, id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryApplicationVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// Gets the current state of the gallery Application Version. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (PublishingProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PublishingProfile"); + } + if (PublishingProfile != null) + { + PublishingProfile.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs new file mode 100644 index 0000000000000..f6e7ac008e700 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs @@ -0,0 +1,112 @@ +// +// 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; + + /// + /// The publishing profile of a gallery image version. + /// + public partial class GalleryApplicationVersionPublishingProfile : GalleryArtifactPublishingProfileBase + { + /// + /// Initializes a new instance of the + /// GalleryApplicationVersionPublishingProfile class. + /// + public GalleryApplicationVersionPublishingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryApplicationVersionPublishingProfile class. + /// + /// The target regions where the Image + /// Version is going to be replicated to. This property is + /// updatable. + /// The number of replicas of the Image + /// Version to be created per region. This property would take effect + /// for a region when regionalReplicaCount is not specified. This + /// property is updatable. + /// If set to true, Virtual Machines + /// 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. + /// The end of life date of the gallery + /// 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?)) + : base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType) + { + Source = source; + ContentType = contentType; + EnableHealthCheck = enableHealthCheck; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "source")] + 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; } + + /// + /// Gets or sets optional. Whether or not this application reports + /// health. + /// + [JsonProperty(PropertyName = "enableHealthCheck")] + public bool? EnableHealthCheck { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Source == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Source"); + } + if (Source != null) + { + Source.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionUpdate.cs new file mode 100644 index 0000000000000..d220e04c69aed --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryApplicationVersionUpdate.cs @@ -0,0 +1,99 @@ +// +// 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 Application Version that you + /// want to update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplicationVersionUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryApplicationVersionUpdate + /// class. + /// + public GalleryApplicationVersionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplicationVersionUpdate + /// class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The current state of the gallery + /// Application Version. + public GalleryApplicationVersionUpdate(GalleryApplicationVersionPublishingProfile publishingProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryApplicationVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// Gets the current state of the gallery Application Version. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PublishingProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PublishingProfile"); + } + if (PublishingProfile != null) + { + PublishingProfile.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs new file mode 100644 index 0000000000000..8f21c927feef7 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the basic gallery artifact publishing profile. + /// + public partial class GalleryArtifactPublishingProfileBase + { + /// + /// Initializes a new instance of the + /// GalleryArtifactPublishingProfileBase class. + /// + public GalleryArtifactPublishingProfileBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryArtifactPublishingProfileBase class. + /// + /// The target regions where the Image + /// Version is going to be replicated to. This property is + /// updatable. + /// The number of replicas of the Image + /// Version to be created per region. This property would take effect + /// for a region when regionalReplicaCount is not specified. This + /// property is updatable. + /// If set to true, Virtual Machines + /// 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. + /// The end of life date of the gallery + /// 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' + public GalleryArtifactPublishingProfileBase(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)) + { + TargetRegions = targetRegions; + ReplicaCount = replicaCount; + ExcludeFromLatest = excludeFromLatest; + PublishedDate = publishedDate; + EndOfLifeDate = endOfLifeDate; + StorageAccountType = storageAccountType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target regions where the Image Version is going to + /// be replicated to. This property is updatable. + /// + [JsonProperty(PropertyName = "targetRegions")] + public IList TargetRegions { get; set; } + + /// + /// Gets or sets the number of replicas of the Image Version to be + /// created per region. This property would take effect for a region + /// when regionalReplicaCount is not specified. This property is + /// updatable. + /// + [JsonProperty(PropertyName = "replicaCount")] + public int? ReplicaCount { get; set; } + + /// + /// Gets or sets if set to true, Virtual Machines deployed from the + /// latest version of the Image Definition won't use this Image + /// Version. + /// + [JsonProperty(PropertyName = "excludeFromLatest")] + public bool? ExcludeFromLatest { get; set; } + + /// + /// 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. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets 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' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactSource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactSource.cs new file mode 100644 index 0000000000000..1419a0c08ed01 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactSource.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source image from which the Image Version is going to be created. + /// + public partial class GalleryArtifactSource + { + /// + /// Initializes a new instance of the GalleryArtifactSource class. + /// + public GalleryArtifactSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryArtifactSource class. + /// + public GalleryArtifactSource(ManagedArtifact managedImage) + { + ManagedImage = managedImage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "managedImage")] + public ManagedArtifact ManagedImage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ManagedImage"); + } + if (ManagedImage != null) + { + ManagedImage.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs new file mode 100644 index 0000000000000..ebe95fdfc09b1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryArtifactVersionSource.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; + + /// + /// The gallery artifact version source. + /// + public partial class GalleryArtifactVersionSource + { + /// + /// Initializes a new instance of the GalleryArtifactVersionSource + /// class. + /// + public GalleryArtifactVersionSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryArtifactVersionSource + /// class. + /// + /// The id of the gallery artifact version source. Can + /// 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(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the gallery artifact version source. Can + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryDataDiskImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryDataDiskImage.cs new file mode 100644 index 0000000000000..dded924670dd2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryDataDiskImage.cs @@ -0,0 +1,73 @@ +// +// 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; + + /// + /// This is the data disk image. + /// + public partial class GalleryDataDiskImage : GalleryDiskImage + { + /// + /// Initializes a new instance of the GalleryDataDiskImage class. + /// + public GalleryDataDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryDataDiskImage class. + /// + /// This property specifies the logical unit number + /// of the data disk. This value is used to identify data disks within + /// the Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// This property indicates the size of the VHD + /// to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public GalleryDataDiskImage(int lun, int? sizeInGB = default(int?), HostCaching? hostCaching = default(HostCaching?), GalleryArtifactVersionSource source = default(GalleryArtifactVersionSource)) + : base(sizeInGB, hostCaching, source) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property specifies the logical unit number of the + /// data disk. This value is used to identify data disks within the + /// Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryDiskImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryDiskImage.cs new file mode 100644 index 0000000000000..24fa155c0709c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryDiskImage.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 Newtonsoft.Json; + using System.Linq; + + /// + /// This is the disk image base class. + /// + public partial class GalleryDiskImage + { + /// + /// Initializes a new instance of the GalleryDiskImage class. + /// + public GalleryDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryDiskImage class. + /// + /// This property indicates the size of the VHD + /// to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public GalleryDiskImage(int? sizeInGB = default(int?), HostCaching? hostCaching = default(HostCaching?), GalleryArtifactVersionSource source = default(GalleryArtifactVersionSource)) + { + SizeInGB = sizeInGB; + HostCaching = hostCaching; + Source = source; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets this property indicates the size of the VHD to be created. + /// + [JsonProperty(PropertyName = "sizeInGB")] + public int? SizeInGB { get; private set; } + + /// + /// Gets or sets the host caching of the disk. Valid values are 'None', + /// 'ReadOnly', and 'ReadWrite'. Possible values include: 'None', + /// 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "hostCaching")] + public HostCaching? HostCaching { get; set; } + + /// + /// + [JsonProperty(PropertyName = "source")] + public GalleryArtifactVersionSource Source { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryIdentifier.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryIdentifier.cs new file mode 100644 index 0000000000000..37791d8d2e020 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryIdentifier.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.Linq; + + /// + /// Describes the gallery unique name. + /// + public partial class GalleryIdentifier + { + /// + /// Initializes a new instance of the GalleryIdentifier class. + /// + public GalleryIdentifier() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryIdentifier class. + /// + /// The unique name of the Shared Image + /// Gallery. This name is generated automatically by Azure. + public GalleryIdentifier(string uniqueName = default(string)) + { + UniqueName = uniqueName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique name of the Shared Image Gallery. This name is + /// generated automatically by Azure. + /// + [JsonProperty(PropertyName = "uniqueName")] + public string UniqueName { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImage.cs new file mode 100644 index 0000000000000..62dbb59864dfc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImage.cs @@ -0,0 +1,209 @@ +// +// 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 GalleryImage : Resource + { + /// + /// Initializes a new instance of the GalleryImage class. + /// + public GalleryImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImage class. + /// + /// Resource location + /// 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 Id + /// 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 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 + /// 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), 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; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + OsType = osType; + OsState = osState; + HyperVGeneration = hyperVGeneration; + Features = features; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + PurchasePlan = purchasePlan; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// 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. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// 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 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; } + + /// + /// 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; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Gets the current state of the gallery image definition. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Identifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Identifier"); + } + if (Identifier != null) + { + Identifier.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageFeature.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageFeature.cs new file mode 100644 index 0000000000000..2aa52c29b60bc --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageIdentifier.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageIdentifier.cs new file mode 100644 index 0000000000000..5f3835b6879fa --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageIdentifier.cs @@ -0,0 +1,92 @@ +// +// 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; + + /// + /// This is the gallery image definition identifier. + /// + public partial class GalleryImageIdentifier + { + /// + /// Initializes a new instance of the GalleryImageIdentifier class. + /// + public GalleryImageIdentifier() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageIdentifier class. + /// + /// The name of the gallery image definition + /// publisher. + /// The name of the gallery image definition + /// offer. + /// The name of the gallery image definition + /// SKU. + public GalleryImageIdentifier(string publisher, string offer, string sku) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// 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. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the name of the gallery image definition SKU. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Offer"); + } + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageUpdate.cs new file mode 100644 index 0000000000000..de806c8b415bb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageUpdate.cs @@ -0,0 +1,207 @@ +// +// 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 update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryImageUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryImageUpdate class. + /// + public GalleryImageUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageUpdate 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 Id + /// 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 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 + /// 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), 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; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + OsType = osType; + OsState = osState; + HyperVGeneration = hyperVGeneration; + Features = features; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + PurchasePlan = purchasePlan; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// 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. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// 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 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; } + + /// + /// 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; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Gets the current state of the gallery image definition. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private 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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersion.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersion.cs new file mode 100644 index 0000000000000..707a553ae2c51 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersion.cs @@ -0,0 +1,101 @@ +// +// 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 version that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryImageVersion : Resource + { + /// + /// Initializes a new instance of the GalleryImageVersion class. + /// + public GalleryImageVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageVersion class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The current state of the gallery + /// 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) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + StorageProfile = storageProfile; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryImageVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// Gets the current state of the gallery image version. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public GalleryImageVersionStorageProfile StorageProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageProfile"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs new file mode 100644 index 0000000000000..d047e097275a6 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs @@ -0,0 +1,66 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The publishing profile of a gallery image Version. + /// + public partial class GalleryImageVersionPublishingProfile : GalleryArtifactPublishingProfileBase + { + /// + /// Initializes a new instance of the + /// GalleryImageVersionPublishingProfile class. + /// + public GalleryImageVersionPublishingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryImageVersionPublishingProfile class. + /// + /// The target regions where the Image + /// Version is going to be replicated to. This property is + /// updatable. + /// The number of replicas of the Image + /// Version to be created per region. This property would take effect + /// for a region when regionalReplicaCount is not specified. This + /// property is updatable. + /// If set to true, Virtual Machines + /// 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. + /// The end of life date of the gallery + /// 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' + public GalleryImageVersionPublishingProfile(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)) + : base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.cs new file mode 100644 index 0000000000000..d25499181cbcc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.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; + + /// + /// This is the storage profile of a Gallery Image Version. + /// + public partial class GalleryImageVersionStorageProfile + { + /// + /// Initializes a new instance of the GalleryImageVersionStorageProfile + /// class. + /// + public GalleryImageVersionStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageVersionStorageProfile + /// class. + /// + /// A list of data disk images. + public GalleryImageVersionStorageProfile(GalleryArtifactVersionSource source = default(GalleryArtifactVersionSource), GalleryOSDiskImage osDiskImage = default(GalleryOSDiskImage), IList dataDiskImages = default(IList)) + { + Source = source; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "source")] + public GalleryArtifactVersionSource Source { get; set; } + + /// + /// + [JsonProperty(PropertyName = "osDiskImage")] + public GalleryOSDiskImage OsDiskImage { get; set; } + + /// + /// Gets or sets a list of data disk images. + /// + [JsonProperty(PropertyName = "dataDiskImages")] + public IList DataDiskImages { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionUpdate.cs new file mode 100644 index 0000000000000..174e5218e0fe5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryImageVersionUpdate.cs @@ -0,0 +1,99 @@ +// +// 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 version that you want to + /// update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryImageVersionUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryImageVersionUpdate class. + /// + public GalleryImageVersionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageVersionUpdate class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The current state of the gallery + /// 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) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + StorageProfile = storageProfile; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryImageVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// Gets the current state of the gallery image version. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public GalleryImageVersionStorageProfile StorageProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageProfile"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryOSDiskImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryOSDiskImage.cs new file mode 100644 index 0000000000000..88501804a832f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryOSDiskImage.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; + + /// + /// This is the OS disk image. + /// + public partial class GalleryOSDiskImage : GalleryDiskImage + { + /// + /// Initializes a new instance of the GalleryOSDiskImage class. + /// + public GalleryOSDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryOSDiskImage class. + /// + /// This property indicates the size of the VHD + /// to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public GalleryOSDiskImage(int? sizeInGB = default(int?), HostCaching? hostCaching = default(HostCaching?), GalleryArtifactVersionSource source = default(GalleryArtifactVersionSource)) + : base(sizeInGB, hostCaching, source) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GallerySharingPermissionTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GallerySharingPermissionTypes.cs new file mode 100644 index 0000000000000..22f0125b9557b --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryUpdate.cs new file mode 100644 index 0000000000000..23ea5f90f3c5e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GalleryUpdate.cs @@ -0,0 +1,90 @@ +// +// 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 Shared Image Gallery that you want to + /// update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryUpdate class. + /// + public GalleryUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryUpdate class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this Shared Image + /// 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), SharingProfile sharingProfile = default(SharingProfile)) + : base(id, name, type, tags) + { + Description = description; + Identifier = identifier; + ProvisioningState = provisioningState; + SharingProfile = sharingProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this Shared Image Gallery resource. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryIdentifier Identifier { get; set; } + + /// + /// Gets the current state of the gallery. + /// + /// + /// The provisioning state, which only appears in the response. + /// Possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.sharingProfile")] + public SharingProfile SharingProfile { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GrantAccessData.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GrantAccessData.cs new file mode 100644 index 0000000000000..77328c91945bd --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/GrantAccessData.cs @@ -0,0 +1,75 @@ +// +// 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; + + /// + /// Data used for requesting a SAS. + /// + public partial class GrantAccessData + { + /// + /// Initializes a new instance of the GrantAccessData class. + /// + public GrantAccessData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GrantAccessData class. + /// + /// Possible values include: 'None', 'Read', + /// 'Write' + /// Time duration in seconds until the + /// SAS access expires. + public GrantAccessData(string access, int durationInSeconds) + { + Access = access; + DurationInSeconds = durationInSeconds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'None', 'Read', 'Write' + /// + [JsonProperty(PropertyName = "access")] + public string Access { get; set; } + + /// + /// Gets or sets time duration in seconds until the SAS access expires. + /// + [JsonProperty(PropertyName = "durationInSeconds")] + public int DurationInSeconds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Access == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Access"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HardwareProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HardwareProfile.cs new file mode 100644 index 0000000000000..d82198706c791 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HardwareProfile.cs @@ -0,0 +1,183 @@ +// +// 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; + + /// + /// Specifies the hardware settings for the virtual machine. + /// + public partial class HardwareProfile + { + /// + /// Initializes a new instance of the HardwareProfile class. + /// + public HardwareProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HardwareProfile class. + /// + /// Specifies the size of the virtual machine. + /// <br><br> The enum data type is currently deprecated and + /// will be removed by December 23rd 2023. <br><br> + /// Recommended way to get the list of available sizes is using these + /// APIs: <br><br> [List all available virtual machine + /// sizes in an availability + /// set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) + /// <br><br> [List all available virtual machine sizes in a + /// region]( + /// https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) + /// <br><br> [List all available virtual machine sizes for + /// resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). + /// For more information about virtual machine sizes, see [Sizes for + /// virtual + /// machines](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes). + /// <br><br> The available VM sizes depend on region and + /// availability set. Possible values include: 'Basic_A0', 'Basic_A1', + /// 'Basic_A2', 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', + /// 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5', + /// 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', + /// 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2_v2', + /// 'Standard_A4_v2', 'Standard_A8_v2', 'Standard_A2m_v2', + /// 'Standard_A4m_v2', 'Standard_A8m_v2', 'Standard_B1s', + /// 'Standard_B1ms', 'Standard_B2s', 'Standard_B2ms', 'Standard_B4ms', + /// 'Standard_B8ms', 'Standard_D1', 'Standard_D2', 'Standard_D3', + /// 'Standard_D4', 'Standard_D11', 'Standard_D12', 'Standard_D13', + /// 'Standard_D14', 'Standard_D1_v2', 'Standard_D2_v2', + /// 'Standard_D3_v2', 'Standard_D4_v2', 'Standard_D5_v2', + /// 'Standard_D2_v3', 'Standard_D4_v3', 'Standard_D8_v3', + /// 'Standard_D16_v3', 'Standard_D32_v3', 'Standard_D64_v3', + /// 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', + /// 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', + /// 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2', + /// 'Standard_D14_v2', 'Standard_D15_v2', 'Standard_DS1', + /// 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', + /// 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', + /// 'Standard_DS1_v2', 'Standard_DS2_v2', 'Standard_DS3_v2', + /// 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_DS11_v2', + /// 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', + /// 'Standard_DS15_v2', 'Standard_DS13-4_v2', 'Standard_DS13-2_v2', + /// 'Standard_DS14-8_v2', 'Standard_DS14-4_v2', 'Standard_E2_v3', + /// 'Standard_E4_v3', 'Standard_E8_v3', 'Standard_E16_v3', + /// 'Standard_E32_v3', 'Standard_E64_v3', 'Standard_E2s_v3', + /// 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', + /// 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_E32-16_v3', + /// 'Standard_E32-8s_v3', 'Standard_E64-32s_v3', 'Standard_E64-16s_v3', + /// 'Standard_F1', 'Standard_F2', 'Standard_F4', 'Standard_F8', + /// 'Standard_F16', 'Standard_F1s', 'Standard_F2s', 'Standard_F4s', + /// 'Standard_F8s', 'Standard_F16s', 'Standard_F2s_v2', + /// 'Standard_F4s_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', + /// 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', + /// 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + /// 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + /// 'Standard_GS4', 'Standard_GS5', 'Standard_GS4-8', 'Standard_GS4-4', + /// 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H8', 'Standard_H16', + /// 'Standard_H8m', 'Standard_H16m', 'Standard_H16r', 'Standard_H16mr', + /// 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s', + /// 'Standard_M64s', 'Standard_M64ms', 'Standard_M128s', + /// 'Standard_M128ms', 'Standard_M64-32ms', 'Standard_M64-16ms', + /// 'Standard_M128-64ms', 'Standard_M128-32ms', 'Standard_NC6', + /// 'Standard_NC12', 'Standard_NC24', 'Standard_NC24r', + /// 'Standard_NC6s_v2', 'Standard_NC12s_v2', 'Standard_NC24s_v2', + /// 'Standard_NC24rs_v2', 'Standard_NC6s_v3', 'Standard_NC12s_v3', + /// 'Standard_NC24s_v3', 'Standard_NC24rs_v3', 'Standard_ND6s', + /// 'Standard_ND12s', 'Standard_ND24s', 'Standard_ND24rs', + /// 'Standard_NV6', 'Standard_NV12', 'Standard_NV24' + public HardwareProfile(string vmSize = default(string)) + { + VmSize = vmSize; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the size of the virtual machine. + /// &lt;br&gt;&lt;br&gt; The enum data type is + /// currently deprecated and will be removed by December 23rd 2023. + /// &lt;br&gt;&lt;br&gt; Recommended way to get the + /// list of available sizes is using these APIs: + /// &lt;br&gt;&lt;br&gt; [List all available virtual + /// machine sizes in an availability + /// set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) + /// &lt;br&gt;&lt;br&gt; [List all available virtual + /// machine sizes in a region]( + /// https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) + /// &lt;br&gt;&lt;br&gt; [List all available virtual + /// machine sizes for + /// resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). + /// For more information about virtual machine sizes, see [Sizes for + /// virtual + /// machines](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes). + /// &lt;br&gt;&lt;br&gt; The available VM sizes depend + /// on region and availability set. Possible values include: + /// 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', 'Basic_A4', + /// 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', + /// 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', + /// 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', + /// 'Standard_A1_v2', 'Standard_A2_v2', 'Standard_A4_v2', + /// 'Standard_A8_v2', 'Standard_A2m_v2', 'Standard_A4m_v2', + /// 'Standard_A8m_v2', 'Standard_B1s', 'Standard_B1ms', 'Standard_B2s', + /// 'Standard_B2ms', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', + /// 'Standard_D2', 'Standard_D3', 'Standard_D4', 'Standard_D11', + /// 'Standard_D12', 'Standard_D13', 'Standard_D14', 'Standard_D1_v2', + /// 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2', + /// 'Standard_D5_v2', 'Standard_D2_v3', 'Standard_D4_v3', + /// 'Standard_D8_v3', 'Standard_D16_v3', 'Standard_D32_v3', + /// 'Standard_D64_v3', 'Standard_D2s_v3', 'Standard_D4s_v3', + /// 'Standard_D8s_v3', 'Standard_D16s_v3', 'Standard_D32s_v3', + /// 'Standard_D64s_v3', 'Standard_D11_v2', 'Standard_D12_v2', + /// 'Standard_D13_v2', 'Standard_D14_v2', 'Standard_D15_v2', + /// 'Standard_DS1', 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', + /// 'Standard_DS11', 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', + /// 'Standard_DS1_v2', 'Standard_DS2_v2', 'Standard_DS3_v2', + /// 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_DS11_v2', + /// 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', + /// 'Standard_DS15_v2', 'Standard_DS13-4_v2', 'Standard_DS13-2_v2', + /// 'Standard_DS14-8_v2', 'Standard_DS14-4_v2', 'Standard_E2_v3', + /// 'Standard_E4_v3', 'Standard_E8_v3', 'Standard_E16_v3', + /// 'Standard_E32_v3', 'Standard_E64_v3', 'Standard_E2s_v3', + /// 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', + /// 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_E32-16_v3', + /// 'Standard_E32-8s_v3', 'Standard_E64-32s_v3', 'Standard_E64-16s_v3', + /// 'Standard_F1', 'Standard_F2', 'Standard_F4', 'Standard_F8', + /// 'Standard_F16', 'Standard_F1s', 'Standard_F2s', 'Standard_F4s', + /// 'Standard_F8s', 'Standard_F16s', 'Standard_F2s_v2', + /// 'Standard_F4s_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', + /// 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', + /// 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + /// 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + /// 'Standard_GS4', 'Standard_GS5', 'Standard_GS4-8', 'Standard_GS4-4', + /// 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H8', 'Standard_H16', + /// 'Standard_H8m', 'Standard_H16m', 'Standard_H16r', 'Standard_H16mr', + /// 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s', + /// 'Standard_M64s', 'Standard_M64ms', 'Standard_M128s', + /// 'Standard_M128ms', 'Standard_M64-32ms', 'Standard_M64-16ms', + /// 'Standard_M128-64ms', 'Standard_M128-32ms', 'Standard_NC6', + /// 'Standard_NC12', 'Standard_NC24', 'Standard_NC24r', + /// 'Standard_NC6s_v2', 'Standard_NC12s_v2', 'Standard_NC24s_v2', + /// 'Standard_NC24rs_v2', 'Standard_NC6s_v3', 'Standard_NC12s_v3', + /// 'Standard_NC24s_v3', 'Standard_NC24rs_v3', 'Standard_ND6s', + /// 'Standard_ND12s', 'Standard_ND24s', 'Standard_ND24rs', + /// 'Standard_NV6', 'Standard_NV12', 'Standard_NV24' + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HostCaching.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HostCaching.cs new file mode 100644 index 0000000000000..c140f54623313 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HostCaching.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for HostCaching. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum HostCaching + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "ReadOnly")] + ReadOnly, + [EnumMember(Value = "ReadWrite")] + ReadWrite + } + internal static class HostCachingEnumExtension + { + internal static string ToSerializedValue(this HostCaching? value) + { + return value == null ? null : ((HostCaching)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this HostCaching value) + { + switch( value ) + { + case HostCaching.None: + return "None"; + case HostCaching.ReadOnly: + return "ReadOnly"; + case HostCaching.ReadWrite: + return "ReadWrite"; + } + return null; + } + + internal static HostCaching? ParseHostCaching(this string value) + { + switch( value ) + { + case "None": + return HostCaching.None; + case "ReadOnly": + return HostCaching.ReadOnly; + case "ReadWrite": + return HostCaching.ReadWrite; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGeneration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGeneration.cs new file mode 100644 index 0000000000000..5693436316967 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGeneration.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 HyperVGeneration. + /// + public static class HyperVGeneration + { + public const string V1 = "V1"; + public const string V2 = "V2"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGenerationType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGenerationType.cs new file mode 100644 index 0000000000000..d8e6cbcd3646b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGenerationType.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 HyperVGenerationType. + /// + public static class HyperVGenerationType + { + public const string V1 = "V1"; + public const string V2 = "V2"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGenerationTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGenerationTypes.cs new file mode 100644 index 0000000000000..50b6873023860 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HyperVGenerationTypes.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 HyperVGenerationTypes. + /// + public static class HyperVGenerationTypes + { + public const string V1 = "V1"; + public const string V2 = "V2"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/IPVersion.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/IPVersion.cs new file mode 100644 index 0000000000000..b084ca6e2b503 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/IPVersion.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 IPVersion. + /// + public static class IPVersion + { + public const string IPv4 = "IPv4"; + public const string IPv6 = "IPv6"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Image.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Image.cs new file mode 100644 index 0000000000000..5affb9549c32b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Image.cs @@ -0,0 +1,122 @@ +// +// 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; + + /// + /// The source user image virtual hard disk. The virtual hard disk will be + /// copied before being attached to the virtual machine. If SourceImage is + /// provided, the destination virtual hard drive must not exist. + /// + [Rest.Serialization.JsonTransformation] + public partial class Image : Resource + { + /// + /// Initializes a new instance of the Image class. + /// + public Image() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Image class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The source virtual machine from + /// which Image is created. + /// Specifies the storage settings for the + /// virtual machine disks. + /// The provisioning state. + /// Gets the HyperVGenerationType of the + /// VirtualMachine created from the image. Possible values include: + /// 'V1', 'V2' + /// The extended location of the + /// Image. + public Image(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + SourceVirtualMachine = sourceVirtualMachine; + StorageProfile = storageProfile; + ProvisioningState = provisioningState; + HyperVGeneration = hyperVGeneration; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source virtual machine from which Image is + /// created. + /// + [JsonProperty(PropertyName = "properties.sourceVirtualMachine")] + public SubResource SourceVirtualMachine { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public ImageStorageProfile StorageProfile { get; set; } + + /// + /// Gets the provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the HyperVGenerationType of the VirtualMachine created from + /// the image. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets the extended location of the Image. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDataDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDataDisk.cs new file mode 100644 index 0000000000000..cc8a8b640427a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDataDisk.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 data disk. + /// + public partial class ImageDataDisk : ImageDisk + { + /// + /// Initializes a new instance of the ImageDataDisk class. + /// + public ImageDataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDataDisk class. + /// + /// Specifies the logical unit number of the data + /// disk. This value is used to identify data disks within the VM and + /// therefore must be unique for each data disk attached to a + /// VM. + /// The snapshot. + /// The managedDisk. + /// The Virtual Hard Disk. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies the size of empty data disks in + /// gigabytes. This element can be used to overwrite the name of the + /// disk in a virtual machine image. <br><br> This value + /// cannot be larger than 1023 GB + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageDataDisk(int lun, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the logical unit number of the data disk. + /// This value is used to identify data disks within the VM and + /// therefore must be unique for each data disk attached to a VM. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDisk.cs new file mode 100644 index 0000000000000..2136d9ab3e360 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDisk.cs @@ -0,0 +1,126 @@ +// +// 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 image disk. + /// + public partial class ImageDisk + { + /// + /// Initializes a new instance of the ImageDisk class. + /// + public ImageDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDisk class. + /// + /// The snapshot. + /// The managedDisk. + /// The Virtual Hard Disk. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies the size of empty data disks in + /// gigabytes. This element can be used to overwrite the name of the + /// disk in a virtual machine image. <br><br> This value + /// cannot be larger than 1023 GB + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageDisk(SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + { + Snapshot = snapshot; + ManagedDisk = managedDisk; + BlobUri = blobUri; + Caching = caching; + DiskSizeGB = diskSizeGB; + StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the snapshot. + /// + [JsonProperty(PropertyName = "snapshot")] + public SubResource Snapshot { get; set; } + + /// + /// Gets or sets the managedDisk. + /// + [JsonProperty(PropertyName = "managedDisk")] + public SubResource ManagedDisk { get; set; } + + /// + /// Gets or sets the Virtual Hard Disk. + /// + [JsonProperty(PropertyName = "blobUri")] + public string BlobUri { get; set; } + + /// + /// Gets or sets specifies the caching requirements. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **ReadOnly** + /// &lt;br&gt;&lt;br&gt; **ReadWrite** + /// &lt;br&gt;&lt;br&gt; Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies the size of empty data disks in gigabytes. + /// This element can be used to overwrite the name of the disk in a + /// virtual machine image. &lt;br&gt;&lt;br&gt; This + /// value cannot be larger than 1023 GB + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets specifies the storage account type for the managed + /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it + /// cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed image disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDiskReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDiskReference.cs new file mode 100644 index 0000000000000..d13ae52d5d2f3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDiskReference.cs @@ -0,0 +1,79 @@ +// +// 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; + + /// + /// The source image used for creating the disk. + /// + public partial class ImageDiskReference + { + /// + /// Initializes a new instance of the ImageDiskReference class. + /// + public ImageDiskReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDiskReference class. + /// + /// A relative uri containing either a Platform Image + /// Repository or user image reference. + /// If the disk is created from an image's data disk, + /// this is an index that indicates which of the data disks in the + /// image to use. For OS disks, this field is null. + public ImageDiskReference(string id, int? lun = default(int?)) + { + Id = id; + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a relative uri containing either a Platform Image + /// Repository or user image reference. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets if the disk is created from an image's data disk, this + /// is an index that indicates which of the data disks in the image to + /// use. For OS disks, this field is null. + /// + [JsonProperty(PropertyName = "lun")] + public int? Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageOSDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageOSDisk.cs new file mode 100644 index 0000000000000..d85a6e103cd80 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageOSDisk.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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an Operating System disk. + /// + public partial class ImageOSDisk : ImageDisk + { + /// + /// Initializes a new instance of the ImageOSDisk class. + /// + public ImageOSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageOSDisk class. + /// + /// This property allows you to specify the type + /// of the OS that is included in the disk if creating a VM from a + /// custom image. <br><br> Possible values are: + /// <br><br> **Windows** <br><br> **Linux**. + /// Possible values include: 'Windows', 'Linux' + /// The OS State. Possible values include: + /// 'Generalized', 'Specialized' + /// The snapshot. + /// The managedDisk. + /// The Virtual Hard Disk. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies the size of empty data disks in + /// gigabytes. This element can be used to overwrite the name of the + /// disk in a virtual machine image. <br><br> This value + /// cannot be larger than 1023 GB + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageOSDisk(OperatingSystemTypes osType, OperatingSystemStateTypes osState, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + { + OsType = osType; + OsState = osState; + 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 if creating a VM from a custom 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 = "osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets the OS State. Possible values include: 'Generalized', + /// 'Specialized' + /// + [JsonProperty(PropertyName = "osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImagePurchasePlan.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImagePurchasePlan.cs new file mode 100644 index 0000000000000..491af12db0e46 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImagePurchasePlan.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.Linq; + + /// + /// Describes the gallery image definition purchase plan. This is used by + /// marketplace images. + /// + public partial class ImagePurchasePlan + { + /// + /// Initializes a new instance of the ImagePurchasePlan class. + /// + public ImagePurchasePlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImagePurchasePlan class. + /// + /// The plan ID. + /// The publisher ID. + /// The product ID. + public ImagePurchasePlan(string name = default(string), string publisher = default(string), string product = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the plan ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher ID. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the product ID. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageReference.cs new file mode 100644 index 0000000000000..3face5d033e6c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageReference.cs @@ -0,0 +1,110 @@ +// +// 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; + + /// + /// Specifies information about the image to use. You can specify + /// information about platform images, marketplace images, or virtual + /// machine images. This element is required when you want to use a + /// platform image, marketplace image, or virtual machine image, but is not + /// used in other creation operations. NOTE: Image reference publisher and + /// offer can only be set when you create the scale set. + /// + public partial class ImageReference : SubResource + { + /// + /// Initializes a new instance of the ImageReference class. + /// + public ImageReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageReference class. + /// + /// Resource Id + /// The image publisher. + /// Specifies the offer of the platform image or + /// marketplace image used to create the virtual machine. + /// The image SKU. + /// Specifies the version of the platform image + /// or marketplace image used to create the virtual machine. The + /// allowed formats are Major.Minor.Build or 'latest'. Major, Minor, + /// and Build are decimal numbers. Specify 'latest' to use the latest + /// version of an image available at deploy time. Even if you use + /// 'latest', the VM image will not automatically update after deploy + /// time even if a new version becomes available. + /// Specifies in decimal numbers, the + /// version of platform image or marketplace image used to create the + /// virtual machine. This readonly field differs from 'version', only + /// if the value specified in 'version' field is 'latest'. + public ImageReference(string id = default(string), string publisher = default(string), string offer = default(string), string sku = default(string), string version = default(string), string exactVersion = default(string)) + : base(id) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + Version = version; + ExactVersion = exactVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the image publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the offer of the platform image or + /// marketplace image used to create the virtual machine. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the image SKU. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets or sets specifies the version of the platform image or + /// marketplace image used to create the virtual machine. The allowed + /// formats are Major.Minor.Build or 'latest'. Major, Minor, and Build + /// are decimal numbers. Specify 'latest' to use the latest version of + /// an image available at deploy time. Even if you use 'latest', the VM + /// image will not automatically update after deploy time even if a new + /// version becomes available. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets specifies in decimal numbers, the version of platform image or + /// marketplace image used to create the virtual machine. This readonly + /// field differs from 'version', only if the value specified in + /// 'version' field is 'latest'. + /// + [JsonProperty(PropertyName = "exactVersion")] + public string ExactVersion { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageStorageProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageStorageProfile.cs new file mode 100644 index 0000000000000..c6f4ffc55dffb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageStorageProfile.cs @@ -0,0 +1,113 @@ +// +// 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 storage profile. + /// + public partial class ImageStorageProfile + { + /// + /// Initializes a new instance of the ImageStorageProfile class. + /// + public ImageStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageStorageProfile class. + /// + /// Specifies information about the operating + /// system disk used by the virtual machine. <br><br> For + /// more information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// Specifies the parameters that are used to + /// add a data disk to a virtual machine. <br><br> For more + /// information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// Specifies whether an image is zone + /// resilient or not. Default is false. Zone resilient images can be + /// created only in regions that provide Zone Redundant Storage + /// (ZRS). + public ImageStorageProfile(ImageOSDisk osDisk = default(ImageOSDisk), IList dataDisks = default(IList), bool? zoneResilient = default(bool?)) + { + OsDisk = osDisk; + DataDisks = dataDisks; + ZoneResilient = zoneResilient; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies information about the operating system disk + /// used by the virtual machine. &lt;br&gt;&lt;br&gt; + /// For more information about disks, see [About disks and VHDs for + /// Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// + [JsonProperty(PropertyName = "osDisk")] + public ImageOSDisk OsDisk { get; set; } + + /// + /// Gets or sets specifies the parameters that are used to add a data + /// disk to a virtual machine. &lt;br&gt;&lt;br&gt; For + /// more information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// Gets or sets specifies whether an image is zone resilient or not. + /// Default is false. Zone resilient images can be created only in + /// regions that provide Zone Redundant Storage (ZRS). + /// + [JsonProperty(PropertyName = "zoneResilient")] + public bool? ZoneResilient { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsDisk != null) + { + OsDisk.Validate(); + } + if (DataDisks != null) + { + foreach (var element in DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageUpdate.cs new file mode 100644 index 0000000000000..20e98317bbbb0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageUpdate.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The source user image virtual hard disk. Only tags may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class ImageUpdate : UpdateResource + { + /// + /// Initializes a new instance of the ImageUpdate class. + /// + public ImageUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageUpdate class. + /// + /// Resource tags + /// The source virtual machine from + /// which Image is created. + /// Specifies the storage settings for the + /// virtual machine disks. + /// The provisioning state. + /// Gets the HyperVGenerationType of the + /// VirtualMachine created from the image. Possible values include: + /// 'V1', 'V2' + public ImageUpdate(IDictionary tags = default(IDictionary), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string)) + : base(tags) + { + SourceVirtualMachine = sourceVirtualMachine; + StorageProfile = storageProfile; + ProvisioningState = provisioningState; + HyperVGeneration = hyperVGeneration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source virtual machine from which Image is + /// created. + /// + [JsonProperty(PropertyName = "properties.sourceVirtualMachine")] + public SubResource SourceVirtualMachine { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public ImageStorageProfile StorageProfile { get; set; } + + /// + /// Gets the provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the HyperVGenerationType of the VirtualMachine created from + /// the image. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InnerError.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InnerError.cs new file mode 100644 index 0000000000000..781614b2e68ef --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InnerError.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Inner error details. + /// + public partial class InnerError + { + /// + /// Initializes a new instance of the InnerError class. + /// + public InnerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InnerError class. + /// + /// The exception type. + /// The internal error message or exception + /// dump. + public InnerError(string exceptiontype = default(string), string errordetail = default(string)) + { + Exceptiontype = exceptiontype; + Errordetail = errordetail; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the exception type. + /// + [JsonProperty(PropertyName = "exceptiontype")] + public string Exceptiontype { get; set; } + + /// + /// Gets or sets the internal error message or exception dump. + /// + [JsonProperty(PropertyName = "errordetail")] + public string Errordetail { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewStatus.cs new file mode 100644 index 0000000000000..ce05542f9f877 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewStatus.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 InstanceViewStatus + { + /// + /// Initializes a new instance of the InstanceViewStatus class. + /// + public InstanceViewStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstanceViewStatus class. + /// + /// The status code. + /// The level code. Possible values include: + /// 'Info', 'Warning', 'Error' + /// The short localizable label for the + /// status. + /// The detailed status message, including for + /// alerts and error messages. + /// The time of the status. + public InstanceViewStatus(string code = default(string), StatusLevelTypes? level = default(StatusLevelTypes?), string displayStatus = default(string), string message = default(string), System.DateTime? time = default(System.DateTime?)) + { + Code = code; + Level = level; + DisplayStatus = displayStatus; + Message = message; + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the level code. Possible values include: 'Info', + /// 'Warning', 'Error' + /// + [JsonProperty(PropertyName = "level")] + public StatusLevelTypes? Level { get; set; } + + /// + /// Gets or sets the short localizable label for the status. + /// + [JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus { get; set; } + + /// + /// Gets or sets the detailed status message, including for alerts and + /// error messages. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the time of the status. + /// + [JsonProperty(PropertyName = "time")] + public System.DateTime? Time { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewTypes.cs new file mode 100644 index 0000000000000..a87cde5cc1950 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InstanceViewTypes.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for InstanceViewTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum InstanceViewTypes + { + [EnumMember(Value = "instanceView")] + InstanceView + } + internal static class InstanceViewTypesEnumExtension + { + internal static string ToSerializedValue(this InstanceViewTypes? value) + { + return value == null ? null : ((InstanceViewTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this InstanceViewTypes value) + { + switch( value ) + { + case InstanceViewTypes.InstanceView: + return "instanceView"; + } + return null; + } + + internal static InstanceViewTypes? ParseInstanceViewTypes(this string value) + { + switch( value ) + { + case "instanceView": + return InstanceViewTypes.InstanceView; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/IntervalInMins.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/IntervalInMins.cs new file mode 100644 index 0000000000000..3438b2d9c3599 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/IntervalInMins.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for IntervalInMins. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IntervalInMins + { + [EnumMember(Value = "ThreeMins")] + ThreeMins, + [EnumMember(Value = "FiveMins")] + FiveMins, + [EnumMember(Value = "ThirtyMins")] + ThirtyMins, + [EnumMember(Value = "SixtyMins")] + SixtyMins + } + internal static class IntervalInMinsEnumExtension + { + internal static string ToSerializedValue(this IntervalInMins? value) + { + return value == null ? null : ((IntervalInMins)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this IntervalInMins value) + { + switch( value ) + { + case IntervalInMins.ThreeMins: + return "ThreeMins"; + case IntervalInMins.FiveMins: + return "FiveMins"; + case IntervalInMins.ThirtyMins: + return "ThirtyMins"; + case IntervalInMins.SixtyMins: + return "SixtyMins"; + } + return null; + } + + internal static IntervalInMins? ParseIntervalInMins(this string value) + { + switch( value ) + { + case "ThreeMins": + return IntervalInMins.ThreeMins; + case "FiveMins": + return IntervalInMins.FiveMins; + case "ThirtyMins": + return IntervalInMins.ThirtyMins; + case "SixtyMins": + return IntervalInMins.SixtyMins; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs new file mode 100644 index 0000000000000..c1ad357621790 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs @@ -0,0 +1,81 @@ +// +// 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; + + /// + /// Key Vault Key Url and vault id of KeK, KeK is optional and when + /// provided is used to unwrap the encryptionKey + /// + public partial class KeyVaultAndKeyReference + { + /// + /// Initializes a new instance of the KeyVaultAndKeyReference class. + /// + public KeyVaultAndKeyReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultAndKeyReference class. + /// + /// Resource id of the KeyVault containing + /// the key or secret + /// Url pointing to a key or secret in + /// KeyVault + public KeyVaultAndKeyReference(SourceVault sourceVault, string keyUrl) + { + SourceVault = sourceVault; + KeyUrl = keyUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id of the KeyVault containing the key or + /// secret + /// + [JsonProperty(PropertyName = "sourceVault")] + public SourceVault SourceVault { get; set; } + + /// + /// Gets or sets url pointing to a key or secret in KeyVault + /// + [JsonProperty(PropertyName = "keyUrl")] + public string KeyUrl { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + if (KeyUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyUrl"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs new file mode 100644 index 0000000000000..e19c6a5c8cc60 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Key Vault Secret Url and vault id of the encryption key + /// + public partial class KeyVaultAndSecretReference + { + /// + /// Initializes a new instance of the KeyVaultAndSecretReference class. + /// + public KeyVaultAndSecretReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultAndSecretReference class. + /// + /// Resource id of the KeyVault containing + /// the key or secret + /// Url pointing to a key or secret in + /// KeyVault + public KeyVaultAndSecretReference(SourceVault sourceVault, string secretUrl) + { + SourceVault = sourceVault; + SecretUrl = secretUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id of the KeyVault containing the key or + /// secret + /// + [JsonProperty(PropertyName = "sourceVault")] + public SourceVault SourceVault { get; set; } + + /// + /// Gets or sets url pointing to a key or secret in KeyVault + /// + [JsonProperty(PropertyName = "secretUrl")] + public string SecretUrl { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + if (SecretUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SecretUrl"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultKeyReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultKeyReference.cs new file mode 100644 index 0000000000000..3965245b5f311 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultKeyReference.cs @@ -0,0 +1,79 @@ +// +// 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; + + /// + /// Describes a reference to Key Vault Key + /// + public partial class KeyVaultKeyReference + { + /// + /// Initializes a new instance of the KeyVaultKeyReference class. + /// + public KeyVaultKeyReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultKeyReference class. + /// + /// The URL referencing a key encryption key in + /// Key Vault. + /// The relative URL of the Key Vault + /// containing the key. + public KeyVaultKeyReference(string keyUrl, SubResource sourceVault) + { + KeyUrl = keyUrl; + SourceVault = sourceVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL referencing a key encryption key in Key Vault. + /// + [JsonProperty(PropertyName = "keyUrl")] + public string KeyUrl { get; set; } + + /// + /// Gets or sets the relative URL of the Key Vault containing the key. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyUrl"); + } + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultSecretReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultSecretReference.cs new file mode 100644 index 0000000000000..cf99d6b4c143c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/KeyVaultSecretReference.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a reference to Key Vault Secret + /// + public partial class KeyVaultSecretReference + { + /// + /// Initializes a new instance of the KeyVaultSecretReference class. + /// + public KeyVaultSecretReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultSecretReference class. + /// + /// The URL referencing a secret in a Key + /// Vault. + /// The relative URL of the Key Vault + /// containing the secret. + public KeyVaultSecretReference(string secretUrl, SubResource sourceVault) + { + SecretUrl = secretUrl; + SourceVault = sourceVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL referencing a secret in a Key Vault. + /// + [JsonProperty(PropertyName = "secretUrl")] + public string SecretUrl { get; set; } + + /// + /// Gets or sets the relative URL of the Key Vault containing the + /// secret. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SecretUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SecretUrl"); + } + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LastPatchInstallationSummary.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LastPatchInstallationSummary.cs new file mode 100644 index 0000000000000..3afaee59807a3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LastPatchInstallationSummary.cs @@ -0,0 +1,165 @@ +// +// 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 properties of the last installed patch summary. + /// + public partial class LastPatchInstallationSummary + { + /// + /// Initializes a new instance of the LastPatchInstallationSummary + /// class. + /// + public LastPatchInstallationSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LastPatchInstallationSummary + /// class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the + /// operation that produced this result. It is used to correlate across + /// CRP and extension logs. + /// Describes whether the + /// operation ran out of time before it completed all its intended + /// actions + /// The number of all available + /// patches but not going to be installed because it didn't match a + /// classification or inclusion list entry. + /// The number of all available + /// patches but excluded explicitly by a customer-specified exclusion + /// list match. + /// The number of all available patches + /// expected to be installed over the course of the patch installation + /// operation. + /// The count of patches that + /// successfully installed. + /// The count of patches that failed + /// installation. + /// The UTC timestamp when the operation + /// began. + /// The UTC timestamp when the operation + /// began. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public LastPatchInstallationSummary(string status = default(string), string installationActivityId = default(string), bool? maintenanceWindowExceeded = default(bool?), int? notSelectedPatchCount = default(int?), int? excludedPatchCount = default(int?), int? pendingPatchCount = default(int?), int? installedPatchCount = default(int?), int? failedPatchCount = default(int?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? lastModifiedTime = default(System.DateTime?), ApiError error = default(ApiError)) + { + Status = status; + InstallationActivityId = installationActivityId; + MaintenanceWindowExceeded = maintenanceWindowExceeded; + NotSelectedPatchCount = notSelectedPatchCount; + ExcludedPatchCount = excludedPatchCount; + PendingPatchCount = pendingPatchCount; + InstalledPatchCount = installedPatchCount; + FailedPatchCount = failedPatchCount; + StartTime = startTime; + LastModifiedTime = lastModifiedTime; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "installationActivityId")] + public string InstallationActivityId { get; private set; } + + /// + /// Gets describes whether the operation ran out of time before it + /// completed all its intended actions + /// + [JsonProperty(PropertyName = "maintenanceWindowExceeded")] + public bool? MaintenanceWindowExceeded { get; private set; } + + /// + /// Gets the number of all available patches but not going to be + /// installed because it didn't match a classification or inclusion + /// list entry. + /// + [JsonProperty(PropertyName = "notSelectedPatchCount")] + public int? NotSelectedPatchCount { get; private set; } + + /// + /// Gets the number of all available patches but excluded explicitly by + /// a customer-specified exclusion list match. + /// + [JsonProperty(PropertyName = "excludedPatchCount")] + public int? ExcludedPatchCount { get; private set; } + + /// + /// Gets the number of all available patches expected to be installed + /// over the course of the patch installation operation. + /// + [JsonProperty(PropertyName = "pendingPatchCount")] + public int? PendingPatchCount { get; private set; } + + /// + /// Gets the count of patches that successfully installed. + /// + [JsonProperty(PropertyName = "installedPatchCount")] + public int? InstalledPatchCount { get; private set; } + + /// + /// Gets the count of patches that failed installation. + /// + [JsonProperty(PropertyName = "failedPatchCount")] + public int? FailedPatchCount { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxConfiguration.cs new file mode 100644 index 0000000000000..1ca79999bdbb8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxConfiguration.cs @@ -0,0 +1,96 @@ +// +// 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; + + /// + /// Specifies the Linux operating system settings on the virtual machine. + /// <br><br>For a list of supported Linux distributions, see + /// [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// <br><br> For running non-endorsed distributions, see + /// [Information for Non-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + /// + public partial class LinuxConfiguration + { + /// + /// Initializes a new instance of the LinuxConfiguration class. + /// + public LinuxConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxConfiguration class. + /// + /// Specifies whether + /// password authentication should be disabled. + /// Specifies the ssh key configuration for a Linux + /// OS. + /// Indicates whether virtual machine + /// agent should be provisioned on the virtual machine. + /// <br><br> When this property is not specified in the + /// request body, default behavior is to set it to true. This will + /// ensure that VM Agent is installed on the VM so that extensions can + /// be added to the VM later. + /// Specifies settings related to VM Guest + /// Patching on Linux. + public LinuxConfiguration(bool? disablePasswordAuthentication = default(bool?), SshConfiguration ssh = default(SshConfiguration), bool? provisionVMAgent = default(bool?), LinuxPatchSettings patchSettings = default(LinuxPatchSettings)) + { + DisablePasswordAuthentication = disablePasswordAuthentication; + Ssh = ssh; + ProvisionVMAgent = provisionVMAgent; + PatchSettings = patchSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether password authentication should be + /// disabled. + /// + [JsonProperty(PropertyName = "disablePasswordAuthentication")] + public bool? DisablePasswordAuthentication { get; set; } + + /// + /// Gets or sets specifies the ssh key configuration for a Linux OS. + /// + [JsonProperty(PropertyName = "ssh")] + public SshConfiguration Ssh { get; set; } + + /// + /// Gets or sets indicates whether virtual machine agent should be + /// provisioned on the virtual machine. + /// &lt;br&gt;&lt;br&gt; When this property is not + /// specified in the request body, default behavior is to set it to + /// true. This will ensure that VM Agent is installed on the VM so + /// that extensions can be added to the VM later. + /// + [JsonProperty(PropertyName = "provisionVMAgent")] + public bool? ProvisionVMAgent { get; set; } + + /// + /// Gets or sets specifies settings related to VM Guest Patching on + /// Linux. + /// + [JsonProperty(PropertyName = "patchSettings")] + public LinuxPatchSettings PatchSettings { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxParameters.cs new file mode 100644 index 0000000000000..4deea634136d5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxParameters.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Input for InstallPatches on a Linux VM, as directly received by the API + /// + public partial class LinuxParameters + { + /// + /// Initializes a new instance of the LinuxParameters class. + /// + public LinuxParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxParameters class. + /// + /// The update classifications + /// to select when installing patches for Linux. + /// packages to include in the + /// patch operation. Format: packageName_packageVersion + /// packages to exclude in the + /// patch operation. Format: packageName_packageVersion + /// This is used as a maintenance run + /// identifier for Auto VM Guest Patching in Linux. + public LinuxParameters(IList classificationsToInclude = default(IList), IList packageNameMasksToInclude = default(IList), IList packageNameMasksToExclude = default(IList), string maintenanceRunId = default(string)) + { + ClassificationsToInclude = classificationsToInclude; + PackageNameMasksToInclude = packageNameMasksToInclude; + PackageNameMasksToExclude = packageNameMasksToExclude; + MaintenanceRunId = maintenanceRunId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the update classifications to select when installing + /// patches for Linux. + /// + [JsonProperty(PropertyName = "classificationsToInclude")] + public IList ClassificationsToInclude { get; set; } + + /// + /// Gets or sets packages to include in the patch operation. Format: + /// packageName_packageVersion + /// + [JsonProperty(PropertyName = "packageNameMasksToInclude")] + public IList PackageNameMasksToInclude { get; set; } + + /// + /// Gets or sets packages to exclude in the patch operation. Format: + /// packageName_packageVersion + /// + [JsonProperty(PropertyName = "packageNameMasksToExclude")] + public IList PackageNameMasksToExclude { get; set; } + + /// + /// Gets or sets this is used as a maintenance run identifier for Auto + /// VM Guest Patching in Linux. + /// + [JsonProperty(PropertyName = "maintenanceRunId")] + public string MaintenanceRunId { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxPatchSettings.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxPatchSettings.cs new file mode 100644 index 0000000000000..b330cbd7884a8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxPatchSettings.cs @@ -0,0 +1,66 @@ +// +// 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; + + /// + /// Specifies settings related to VM Guest Patching on Linux. + /// + public partial class LinuxPatchSettings + { + /// + /// Initializes a new instance of the LinuxPatchSettings class. + /// + public LinuxPatchSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxPatchSettings class. + /// + /// Specifies the mode of VM Guest Patching to + /// IaaS virtual machine.<br /><br /> Possible values + /// are:<br /><br /> **ImageDefault** - The virtual + /// machine's default patching configuration is used. <br + /// /><br /> **AutomaticByPlatform** - The virtual machine + /// will be automatically updated by the platform. The property + /// provisionVMAgent must be true. Possible values include: + /// 'ImageDefault', 'AutomaticByPlatform' + public LinuxPatchSettings(string patchMode = default(string)) + { + PatchMode = patchMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mode of VM Guest Patching to IaaS + /// virtual machine.&lt;br /&gt;&lt;br /&gt; Possible + /// values are:&lt;br /&gt;&lt;br /&gt; + /// **ImageDefault** - The virtual machine's default patching + /// configuration is used. &lt;br /&gt;&lt;br /&gt; + /// **AutomaticByPlatform** - The virtual machine will be automatically + /// updated by the platform. The property provisionVMAgent must be + /// true. Possible values include: 'ImageDefault', + /// 'AutomaticByPlatform' + /// + [JsonProperty(PropertyName = "patchMode")] + public string PatchMode { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxVMGuestPatchMode.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxVMGuestPatchMode.cs new file mode 100644 index 0000000000000..403817291610a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxVMGuestPatchMode.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 LinuxVMGuestPatchMode. + /// + public static class LinuxVMGuestPatchMode + { + public const string ImageDefault = "ImageDefault"; + public const string AutomaticByPlatform = "AutomaticByPlatform"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsInputBase.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsInputBase.cs new file mode 100644 index 0000000000000..293dbae4c0646 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsInputBase.cs @@ -0,0 +1,110 @@ +// +// 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; + + /// + /// Api input base class for LogAnalytics Api. + /// + public partial class LogAnalyticsInputBase + { + /// + /// Initializes a new instance of the LogAnalyticsInputBase class. + /// + public LogAnalyticsInputBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsInputBase class. + /// + /// SAS Uri of the logging blob + /// container to which LogAnalytics Api writes output logs to. + /// From time of the query + /// To time of the query + /// Group query result by Throttle + /// Policy applied. + /// Group query result by Operation + /// 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?)) + { + BlobContainerSasUri = blobContainerSasUri; + FromTime = fromTime; + ToTime = toTime; + GroupByThrottlePolicy = groupByThrottlePolicy; + GroupByOperationName = groupByOperationName; + GroupByResourceName = groupByResourceName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SAS Uri of the logging blob container to which + /// LogAnalytics Api writes output logs to. + /// + [JsonProperty(PropertyName = "blobContainerSasUri")] + public string BlobContainerSasUri { get; set; } + + /// + /// Gets or sets from time of the query + /// + [JsonProperty(PropertyName = "fromTime")] + public System.DateTime FromTime { get; set; } + + /// + /// Gets or sets to time of the query + /// + [JsonProperty(PropertyName = "toTime")] + public System.DateTime ToTime { get; set; } + + /// + /// Gets or sets group query result by Throttle Policy applied. + /// + [JsonProperty(PropertyName = "groupByThrottlePolicy")] + public bool? GroupByThrottlePolicy { get; set; } + + /// + /// Gets or sets group query result by Operation Name. + /// + [JsonProperty(PropertyName = "groupByOperationName")] + public bool? GroupByOperationName { get; set; } + + /// + /// Gets or sets group query result by Resource Name. + /// + [JsonProperty(PropertyName = "groupByResourceName")] + public bool? GroupByResourceName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BlobContainerSasUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BlobContainerSasUri"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsOperationResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsOperationResult.cs new file mode 100644 index 0000000000000..f2a5fdcb17e35 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsOperationResult.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.Linq; + + /// + /// LogAnalytics operation status response + /// + public partial class LogAnalyticsOperationResult + { + /// + /// Initializes a new instance of the LogAnalyticsOperationResult + /// class. + /// + public LogAnalyticsOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsOperationResult + /// class. + /// + /// LogAnalyticsOutput + public LogAnalyticsOperationResult(LogAnalyticsOutput properties = default(LogAnalyticsOutput)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets logAnalyticsOutput + /// + [JsonProperty(PropertyName = "properties")] + public LogAnalyticsOutput Properties { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsOutput.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsOutput.cs new file mode 100644 index 0000000000000..97b5920a51ff5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LogAnalyticsOutput.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; + + /// + /// LogAnalytics output properties + /// + public partial class LogAnalyticsOutput + { + /// + /// Initializes a new instance of the LogAnalyticsOutput class. + /// + public LogAnalyticsOutput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsOutput class. + /// + /// Output file Uri path to blob + /// container. + public LogAnalyticsOutput(string output = default(string)) + { + Output = output; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets output file Uri path to blob container. + /// + [JsonProperty(PropertyName = "output")] + public string Output { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/MaintenanceOperationResultCodeTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/MaintenanceOperationResultCodeTypes.cs new file mode 100644 index 0000000000000..fee29be59b267 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/MaintenanceOperationResultCodeTypes.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for MaintenanceOperationResultCodeTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MaintenanceOperationResultCodeTypes + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "RetryLater")] + RetryLater, + [EnumMember(Value = "MaintenanceAborted")] + MaintenanceAborted, + [EnumMember(Value = "MaintenanceCompleted")] + MaintenanceCompleted + } + internal static class MaintenanceOperationResultCodeTypesEnumExtension + { + internal static string ToSerializedValue(this MaintenanceOperationResultCodeTypes? value) + { + return value == null ? null : ((MaintenanceOperationResultCodeTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this MaintenanceOperationResultCodeTypes value) + { + switch( value ) + { + case MaintenanceOperationResultCodeTypes.None: + return "None"; + case MaintenanceOperationResultCodeTypes.RetryLater: + return "RetryLater"; + case MaintenanceOperationResultCodeTypes.MaintenanceAborted: + return "MaintenanceAborted"; + case MaintenanceOperationResultCodeTypes.MaintenanceCompleted: + return "MaintenanceCompleted"; + } + return null; + } + + internal static MaintenanceOperationResultCodeTypes? ParseMaintenanceOperationResultCodeTypes(this string value) + { + switch( value ) + { + case "None": + return MaintenanceOperationResultCodeTypes.None; + case "RetryLater": + return MaintenanceOperationResultCodeTypes.RetryLater; + case "MaintenanceAborted": + return MaintenanceOperationResultCodeTypes.MaintenanceAborted; + case "MaintenanceCompleted": + return MaintenanceOperationResultCodeTypes.MaintenanceCompleted; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/MaintenanceRedeployStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/MaintenanceRedeployStatus.cs new file mode 100644 index 0000000000000..167a3bdf7f878 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/MaintenanceRedeployStatus.cs @@ -0,0 +1,109 @@ +// +// 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; + + /// + /// Maintenance Operation Status. + /// + public partial class MaintenanceRedeployStatus + { + /// + /// Initializes a new instance of the MaintenanceRedeployStatus class. + /// + public MaintenanceRedeployStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceRedeployStatus class. + /// + /// True, if + /// customer is allowed to perform Maintenance. + /// Start Time for the Pre + /// Maintenance Window. + /// End Time for the Pre + /// Maintenance Window. + /// Start Time for the + /// Maintenance Window. + /// End Time for the Maintenance + /// Window. + /// The Last Maintenance + /// Operation Result Code. Possible values include: 'None', + /// 'RetryLater', 'MaintenanceAborted', 'MaintenanceCompleted' + /// Message returned for the last + /// Maintenance Operation. + public MaintenanceRedeployStatus(bool? isCustomerInitiatedMaintenanceAllowed = default(bool?), System.DateTime? preMaintenanceWindowStartTime = default(System.DateTime?), System.DateTime? preMaintenanceWindowEndTime = default(System.DateTime?), System.DateTime? maintenanceWindowStartTime = default(System.DateTime?), System.DateTime? maintenanceWindowEndTime = default(System.DateTime?), MaintenanceOperationResultCodeTypes? lastOperationResultCode = default(MaintenanceOperationResultCodeTypes?), string lastOperationMessage = default(string)) + { + IsCustomerInitiatedMaintenanceAllowed = isCustomerInitiatedMaintenanceAllowed; + PreMaintenanceWindowStartTime = preMaintenanceWindowStartTime; + PreMaintenanceWindowEndTime = preMaintenanceWindowEndTime; + MaintenanceWindowStartTime = maintenanceWindowStartTime; + MaintenanceWindowEndTime = maintenanceWindowEndTime; + LastOperationResultCode = lastOperationResultCode; + LastOperationMessage = lastOperationMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets true, if customer is allowed to perform Maintenance. + /// + [JsonProperty(PropertyName = "isCustomerInitiatedMaintenanceAllowed")] + public bool? IsCustomerInitiatedMaintenanceAllowed { get; set; } + + /// + /// Gets or sets start Time for the Pre Maintenance Window. + /// + [JsonProperty(PropertyName = "preMaintenanceWindowStartTime")] + public System.DateTime? PreMaintenanceWindowStartTime { get; set; } + + /// + /// Gets or sets end Time for the Pre Maintenance Window. + /// + [JsonProperty(PropertyName = "preMaintenanceWindowEndTime")] + public System.DateTime? PreMaintenanceWindowEndTime { get; set; } + + /// + /// Gets or sets start Time for the Maintenance Window. + /// + [JsonProperty(PropertyName = "maintenanceWindowStartTime")] + public System.DateTime? MaintenanceWindowStartTime { get; set; } + + /// + /// Gets or sets end Time for the Maintenance Window. + /// + [JsonProperty(PropertyName = "maintenanceWindowEndTime")] + public System.DateTime? MaintenanceWindowEndTime { get; set; } + + /// + /// Gets or sets the Last Maintenance Operation Result Code. Possible + /// values include: 'None', 'RetryLater', 'MaintenanceAborted', + /// 'MaintenanceCompleted' + /// + [JsonProperty(PropertyName = "lastOperationResultCode")] + public MaintenanceOperationResultCodeTypes? LastOperationResultCode { get; set; } + + /// + /// Gets or sets message returned for the last Maintenance Operation. + /// + [JsonProperty(PropertyName = "lastOperationMessage")] + public string LastOperationMessage { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedArtifact.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedArtifact.cs new file mode 100644 index 0000000000000..07cc6d49434b8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedArtifact.cs @@ -0,0 +1,65 @@ +// +// 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; + + /// + /// The managed artifact. + /// + public partial class ManagedArtifact + { + /// + /// Initializes a new instance of the ManagedArtifact class. + /// + public ManagedArtifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedArtifact class. + /// + /// The managed artifact id. + public ManagedArtifact(string id) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the managed artifact id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedDiskParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedDiskParameters.cs new file mode 100644 index 0000000000000..2048b4a85700a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedDiskParameters.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 Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters of a managed disk. + /// + public partial class ManagedDiskParameters : SubResource + { + /// + /// Initializes a new instance of the ManagedDiskParameters class. + /// + public ManagedDiskParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedDiskParameters class. + /// + /// Resource Id + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed disk. + public ManagedDiskParameters(string id = default(string), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + : base(id) + { + StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the storage account type for the managed + /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it + /// cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkAccessPolicy.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkAccessPolicy.cs new file mode 100644 index 0000000000000..889fa06a09e9d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkAccessPolicy.cs @@ -0,0 +1,33 @@ +// +// 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 NetworkAccessPolicy. + /// + public static class NetworkAccessPolicy + { + /// + /// The disk can be exported or uploaded to from any network. + /// + public const string AllowAll = "AllowAll"; + /// + /// The disk can be exported or uploaded to using a DiskAccess + /// resource's private endpoints. + /// + public const string AllowPrivate = "AllowPrivate"; + /// + /// The disk cannot be exported. + /// + public const string DenyAll = "DenyAll"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkInterfaceReference.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkInterfaceReference.cs new file mode 100644 index 0000000000000..43b12e2e1491a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkInterfaceReference.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; + + /// + /// Describes a network interface reference. + /// + [Rest.Serialization.JsonTransformation] + public partial class NetworkInterfaceReference : SubResource + { + /// + /// Initializes a new instance of the NetworkInterfaceReference class. + /// + public NetworkInterfaceReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkInterfaceReference class. + /// + /// Resource Id + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + public NetworkInterfaceReference(string id = default(string), bool? primary = default(bool?)) + : base(id) + { + Primary = primary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkProfile.cs new file mode 100644 index 0000000000000..39785018b8c0f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkProfile.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; + + /// + /// Specifies the network interfaces of the virtual machine. + /// + public partial class NetworkProfile + { + /// + /// Initializes a new instance of the NetworkProfile class. + /// + public NetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkProfile class. + /// + /// Specifies the list of resource Ids + /// for the network interfaces associated with the virtual + /// machine. + public NetworkProfile(IList networkInterfaces = default(IList)) + { + NetworkInterfaces = networkInterfaces; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the list of resource Ids for the network + /// interfaces associated with the virtual machine. + /// + [JsonProperty(PropertyName = "networkInterfaces")] + public IList NetworkInterfaces { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDisk.cs new file mode 100644 index 0000000000000..feac57710d59f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDisk.cs @@ -0,0 +1,212 @@ +// +// 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; + + /// + /// Specifies information about the operating system disk used by the + /// virtual machine. <br><br> For more information about disks, + /// see [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// + public partial class OSDisk + { + /// + /// Initializes a new instance of the OSDisk class. + /// + public OSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDisk class. + /// + /// Specifies how the virtual machine should + /// be created.<br><br> Possible values + /// are:<br><br> **Attach** \u2013 This value is used when + /// you are using a specialized disk to create the virtual + /// machine.<br><br> **FromImage** \u2013 This value is + /// used when you are using an image to create the virtual machine. If + /// you are using a platform image, you also use the imageReference + /// element described above. If you are using a marketplace image, you + /// also use the plan element previously described. Possible values + /// include: 'FromImage', 'Empty', 'Attach' + /// This property allows you to specify the type + /// of the OS that is included in the disk if creating a VM from + /// user-image or a specialized VHD. <br><br> Possible + /// values are: <br><br> **Windows** <br><br> + /// **Linux**. Possible values include: 'Windows', 'Linux' + /// Specifies the encryption settings + /// for the OS Disk. <br><br> Minimum api-version: + /// 2015-06-15 + /// The disk name. + /// The virtual hard disk. + /// The source user image virtual hard disk. The + /// virtual hard disk will be copied before being attached to the + /// virtual machine. If SourceImage is provided, the destination + /// virtual hard drive must not exist. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None** for Standard + /// storage. **ReadOnly** for Premium storage. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the ephemeral Disk + /// Settings for the operating system disk used by the virtual + /// machine. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. <br><br> This value + /// cannot be larger than 1023 GB + /// The managed disk parameters. + public OSDisk(string createOption, OperatingSystemTypes? osType = default(OperatingSystemTypes?), DiskEncryptionSettings encryptionSettings = default(DiskEncryptionSettings), string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), DiffDiskSettings diffDiskSettings = default(DiffDiskSettings), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters)) + { + OsType = osType; + EncryptionSettings = encryptionSettings; + Name = name; + Vhd = vhd; + Image = image; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + DiffDiskSettings = diffDiskSettings; + CreateOption = createOption; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + 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 if creating a VM from user-image or a + /// specialized VHD. &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 = "osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets specifies the encryption settings for the OS Disk. + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "encryptionSettings")] + public DiskEncryptionSettings EncryptionSettings { get; set; } + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the virtual hard disk. + /// + [JsonProperty(PropertyName = "vhd")] + public VirtualHardDisk Vhd { get; set; } + + /// + /// Gets or sets the source user image virtual hard disk. The virtual + /// hard disk will be copied before being attached to the virtual + /// machine. If SourceImage is provided, the destination virtual hard + /// drive must not exist. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets specifies the caching requirements. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **ReadOnly** + /// &lt;br&gt;&lt;br&gt; **ReadWrite** + /// &lt;br&gt;&lt;br&gt; Default: **None** for Standard + /// storage. **ReadOnly** for Premium storage. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies the ephemeral Disk Settings for the + /// operating system disk used by the virtual machine. + /// + [JsonProperty(PropertyName = "diffDiskSettings")] + public DiffDiskSettings DiffDiskSettings { get; set; } + + /// + /// Gets or sets specifies how the virtual machine should be + /// created.&lt;br&gt;&lt;br&gt; Possible values + /// are:&lt;br&gt;&lt;br&gt; **Attach** \u2013 This + /// value is used when you are using a specialized disk to create the + /// virtual machine.&lt;br&gt;&lt;br&gt; **FromImage** + /// \u2013 This value is used when you are using an image to create the + /// virtual machine. If you are using a platform image, you also use + /// the imageReference element described above. If you are using a + /// marketplace image, you also use the plan element previously + /// described. Possible values include: 'FromImage', 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. &lt;br&gt;&lt;br&gt; This + /// value cannot be larger than 1023 GB + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public ManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + if (EncryptionSettings != null) + { + EncryptionSettings.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDiskImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDiskImage.cs new file mode 100644 index 0000000000000..67e155a05b4bb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDiskImage.cs @@ -0,0 +1,62 @@ +// +// 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; + + /// + /// Contains the os disk image information. + /// + public partial class OSDiskImage + { + /// + /// Initializes a new instance of the OSDiskImage class. + /// + public OSDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDiskImage class. + /// + /// The operating system of the + /// osDiskImage. Possible values include: 'Windows', 'Linux' + public OSDiskImage(OperatingSystemTypes operatingSystem) + { + OperatingSystem = operatingSystem; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operating system of the osDiskImage. Possible + /// values include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "operatingSystem")] + public OperatingSystemTypes OperatingSystem { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDiskImageEncryption.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDiskImageEncryption.cs new file mode 100644 index 0000000000000..f3a17cb418836 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSDiskImageEncryption.cs @@ -0,0 +1,45 @@ +// +// 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; + + /// + /// Contains encryption settings for an OS disk image. + /// + public partial class OSDiskImageEncryption : DiskImageEncryption + { + /// + /// Initializes a new instance of the OSDiskImageEncryption class. + /// + public OSDiskImageEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDiskImageEncryption class. + /// + /// A relative URI containing the + /// resource ID of the disk encryption set. + public OSDiskImageEncryption(string diskEncryptionSetId = default(string)) + : base(diskEncryptionSetId) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSProfile.cs new file mode 100644 index 0000000000000..24355877fd5b0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSProfile.cs @@ -0,0 +1,263 @@ +// +// 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; + + /// + /// Specifies the operating system settings for the virtual machine. Some + /// of the settings cannot be changed once VM is provisioned. + /// + public partial class OSProfile + { + /// + /// Initializes a new instance of the OSProfile class. + /// + public OSProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSProfile class. + /// + /// Specifies the host OS name of the + /// virtual machine. <br><br> This name cannot be updated + /// after the VM is created. <br><br> **Max-length + /// (Windows):** 15 characters <br><br> **Max-length + /// (Linux):** 64 characters. <br><br> For naming + /// conventions and restrictions see [Azure infrastructure services + /// implementation + /// guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). + /// Specifies the name of the administrator + /// account. <br><br> This property cannot be updated after + /// the VM is created. <br><br> **Windows-only + /// restriction:** Cannot end in "." <br><br> **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// <br><br> **Minimum-length (Linux):** 1 character + /// <br><br> **Max-length (Linux):** 64 characters + /// <br><br> **Max-length (Windows):** 20 characters + /// <br><br><li> For root access to the Linux VM, see + /// [Using root privileges on Linux virtual machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)<br><li> + /// For a list of built-in system users on Linux that should not be + /// used in this field, see [Selecting User Names for Linux on + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// Specifies the password of the + /// administrator account. <br><br> **Minimum-length + /// (Windows):** 8 characters <br><br> **Minimum-length + /// (Linux):** 6 characters <br><br> **Max-length + /// (Windows):** 123 characters <br><br> **Max-length + /// (Linux):** 72 characters <br><br> **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// <br> Has lower characters <br>Has upper characters + /// <br> Has a digit <br> Has a special character (Regex + /// match [\W_]) <br><br> **Disallowed values:** "abc@123", + /// "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", + /// "Password!", "Password1", "Password22", "iloveyou!" + /// <br><br> For resetting the password, see [How to reset + /// the Remote Desktop service or its login password in a Windows + /// VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// <br><br> For resetting root password, see [Manage + /// users, SSH, and check or repair disks on Azure Linux VMs using the + /// VMAccess + /// Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + /// Specifies a base-64 encoded string of + /// custom data. The base-64 encoded string is decoded to a binary + /// array that is saved as a file on the Virtual Machine. The maximum + /// length of the binary array is 65535 bytes. <br><br> + /// **Note: Do not pass any secrets or passwords in customData + /// property** <br><br> This property cannot be updated + /// after the VM is created. <br><br> customData is passed + /// to the VM to be saved as a file, for more information see [Custom + /// Data on Azure + /// VMs](https://azure.microsoft.com/en-us/blog/custom-data-and-cloud-init-on-windows-azure/) + /// <br><br> For using cloud-init for your Linux VM, see + /// [Using cloud-init to customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// Specifies Windows operating + /// system settings on the virtual machine. + /// Specifies the Linux operating + /// system settings on the virtual machine. <br><br>For a + /// list of supported Linux distributions, see [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// <br><br> For running non-endorsed distributions, see + /// [Information for Non-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + /// Specifies set of certificates that should be + /// installed onto the virtual machine. + /// Specifies whether extension + /// operations should be allowed on the virtual machine. + /// <br><br>This may only be set to False when no + /// extensions are present on the virtual machine. + /// Specifies whether the + /// guest provision signal is required to infer provision success of + /// the virtual machine. **Note: This property is for private testing + /// only, and all customers must not set the property to + /// false.** + public OSProfile(string computerName = default(string), string adminUsername = default(string), string adminPassword = default(string), string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList), bool? allowExtensionOperations = default(bool?), bool? requireGuestProvisionSignal = default(bool?)) + { + ComputerName = computerName; + AdminUsername = adminUsername; + AdminPassword = adminPassword; + CustomData = customData; + WindowsConfiguration = windowsConfiguration; + LinuxConfiguration = linuxConfiguration; + Secrets = secrets; + AllowExtensionOperations = allowExtensionOperations; + RequireGuestProvisionSignal = requireGuestProvisionSignal; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the host OS name of the virtual machine. + /// &lt;br&gt;&lt;br&gt; This name cannot be updated + /// after the VM is created. &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 15 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 64 + /// characters. &lt;br&gt;&lt;br&gt; For naming + /// conventions and restrictions see [Azure infrastructure services + /// implementation + /// guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). + /// + [JsonProperty(PropertyName = "computerName")] + public string ComputerName { get; set; } + + /// + /// Gets or sets specifies the name of the administrator account. + /// &lt;br&gt;&lt;br&gt; This property cannot be + /// updated after the VM is created. + /// &lt;br&gt;&lt;br&gt; **Windows-only restriction:** + /// Cannot end in "." &lt;br&gt;&lt;br&gt; **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Linux):** 1 + /// character &lt;br&gt;&lt;br&gt; **Max-length + /// (Linux):** 64 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 20 characters + /// &lt;br&gt;&lt;br&gt;&lt;li&gt; For root + /// access to the Linux VM, see [Using root privileges on Linux virtual + /// machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)&lt;br&gt;&lt;li&gt; + /// For a list of built-in system users on Linux that should not be + /// used in this field, see [Selecting User Names for Linux on + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; set; } + + /// + /// Gets or sets specifies the password of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Windows):** + /// 8 characters &lt;br&gt;&lt;br&gt; **Minimum-length + /// (Linux):** 6 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 123 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 72 + /// characters &lt;br&gt;&lt;br&gt; **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// &lt;br&gt; Has lower characters &lt;br&gt;Has upper + /// characters &lt;br&gt; Has a digit &lt;br&gt; Has a + /// special character (Regex match [\W_]) + /// &lt;br&gt;&lt;br&gt; **Disallowed values:** + /// "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + /// "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + /// &lt;br&gt;&lt;br&gt; For resetting the password, + /// see [How to reset the Remote Desktop service or its login password + /// in a Windows + /// VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; For resetting root password, + /// see [Manage users, SSH, and check or repair disks on Azure Linux + /// VMs using the VMAccess + /// Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + /// + [JsonProperty(PropertyName = "adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Gets or sets specifies a base-64 encoded string of custom data. The + /// base-64 encoded string is decoded to a binary array that is saved + /// as a file on the Virtual Machine. The maximum length of the binary + /// array is 65535 bytes. &lt;br&gt;&lt;br&gt; **Note: + /// Do not pass any secrets or passwords in customData property** + /// &lt;br&gt;&lt;br&gt; This property cannot be + /// updated after the VM is created. + /// &lt;br&gt;&lt;br&gt; customData is passed to the VM + /// to be saved as a file, for more information see [Custom Data on + /// Azure + /// VMs](https://azure.microsoft.com/en-us/blog/custom-data-and-cloud-init-on-windows-azure/) + /// &lt;br&gt;&lt;br&gt; For using cloud-init for your + /// Linux VM, see [Using cloud-init to customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// + [JsonProperty(PropertyName = "customData")] + public string CustomData { get; set; } + + /// + /// Gets or sets specifies Windows operating system settings on the + /// virtual machine. + /// + [JsonProperty(PropertyName = "windowsConfiguration")] + public WindowsConfiguration WindowsConfiguration { get; set; } + + /// + /// Gets or sets specifies the Linux operating system settings on the + /// virtual machine. &lt;br&gt;&lt;br&gt;For a list of + /// supported Linux distributions, see [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; For running non-endorsed + /// distributions, see [Information for Non-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + /// + [JsonProperty(PropertyName = "linuxConfiguration")] + public LinuxConfiguration LinuxConfiguration { get; set; } + + /// + /// Gets or sets specifies set of certificates that should be installed + /// onto the virtual machine. + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + /// + /// Gets or sets specifies whether extension operations should be + /// allowed on the virtual machine. + /// &lt;br&gt;&lt;br&gt;This may only be set to False + /// when no extensions are present on the virtual machine. + /// + [JsonProperty(PropertyName = "allowExtensionOperations")] + public bool? AllowExtensionOperations { get; set; } + + /// + /// Gets or sets specifies whether the guest provision signal is + /// required to infer provision success of the virtual machine. + /// **Note: This property is for private testing only, and all + /// customers must not set the property to false.** + /// + [JsonProperty(PropertyName = "requireGuestProvisionSignal")] + public bool? RequireGuestProvisionSignal { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OperatingSystemStateTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OperatingSystemStateTypes.cs new file mode 100644 index 0000000000000..3c2ab5cad8373 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OperatingSystemStateTypes.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OperatingSystemStateTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OperatingSystemStateTypes + { + /// + /// Generalized image. Needs to be provisioned during deployment time. + /// + [EnumMember(Value = "Generalized")] + Generalized, + /// + /// Specialized image. Contains already provisioned OS Disk. + /// + [EnumMember(Value = "Specialized")] + Specialized + } + internal static class OperatingSystemStateTypesEnumExtension + { + internal static string ToSerializedValue(this OperatingSystemStateTypes? value) + { + return value == null ? null : ((OperatingSystemStateTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OperatingSystemStateTypes value) + { + switch( value ) + { + case OperatingSystemStateTypes.Generalized: + return "Generalized"; + case OperatingSystemStateTypes.Specialized: + return "Specialized"; + } + return null; + } + + internal static OperatingSystemStateTypes? ParseOperatingSystemStateTypes(this string value) + { + switch( value ) + { + case "Generalized": + return OperatingSystemStateTypes.Generalized; + case "Specialized": + return OperatingSystemStateTypes.Specialized; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OperatingSystemTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OperatingSystemTypes.cs new file mode 100644 index 0000000000000..e9e9dc929b250 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OperatingSystemTypes.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OperatingSystemTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OperatingSystemTypes + { + [EnumMember(Value = "Windows")] + Windows, + [EnumMember(Value = "Linux")] + Linux + } + internal static class OperatingSystemTypesEnumExtension + { + internal static string ToSerializedValue(this OperatingSystemTypes? value) + { + return value == null ? null : ((OperatingSystemTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OperatingSystemTypes value) + { + switch( value ) + { + case OperatingSystemTypes.Windows: + return "Windows"; + case OperatingSystemTypes.Linux: + return "Linux"; + } + return null; + } + + internal static OperatingSystemTypes? ParseOperatingSystemTypes(this string value) + { + switch( value ) + { + case "Windows": + return OperatingSystemTypes.Windows; + case "Linux": + return OperatingSystemTypes.Linux; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationMode.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationMode.cs new file mode 100644 index 0000000000000..6333b9b1a1c98 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationMode.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OrchestrationMode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OrchestrationMode + { + [EnumMember(Value = "Uniform")] + Uniform, + [EnumMember(Value = "Flexible")] + Flexible + } + internal static class OrchestrationModeEnumExtension + { + internal static string ToSerializedValue(this OrchestrationMode? value) + { + return value == null ? null : ((OrchestrationMode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OrchestrationMode value) + { + switch( value ) + { + case OrchestrationMode.Uniform: + return "Uniform"; + case OrchestrationMode.Flexible: + return "Flexible"; + } + return null; + } + + internal static OrchestrationMode? ParseOrchestrationMode(this string value) + { + switch( value ) + { + case "Uniform": + return OrchestrationMode.Uniform; + case "Flexible": + return OrchestrationMode.Flexible; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceNames.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceNames.cs new file mode 100644 index 0000000000000..30a42bbd138a2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceNames.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 OrchestrationServiceNames. + /// + public static class OrchestrationServiceNames + { + public const string AutomaticRepairs = "AutomaticRepairs"; + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceState.cs new file mode 100644 index 0000000000000..78a78c39724cb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceState.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 OrchestrationServiceState. + /// + public static class OrchestrationServiceState + { + public const string NotRunning = "NotRunning"; + public const string Running = "Running"; + public const string Suspended = "Suspended"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceStateAction.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceStateAction.cs new file mode 100644 index 0000000000000..85263f3144c7a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceStateAction.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 OrchestrationServiceStateAction. + /// + public static class OrchestrationServiceStateAction + { + public const string Resume = "Resume"; + public const string Suspend = "Suspend"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceStateInput.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceStateInput.cs new file mode 100644 index 0000000000000..2eb5ebd10d94e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceStateInput.cs @@ -0,0 +1,84 @@ +// +// 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; + + /// + /// The input for OrchestrationServiceState + /// + public partial class OrchestrationServiceStateInput + { + /// + /// Initializes a new instance of the OrchestrationServiceStateInput + /// class. + /// + public OrchestrationServiceStateInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrchestrationServiceStateInput + /// class. + /// + /// The name of the service. Possible values + /// include: 'AutomaticRepairs', + /// 'DummyOrchestrationServiceName' + /// The action to be performed. Possible values + /// include: 'Resume', 'Suspend' + public OrchestrationServiceStateInput(string serviceName, string action) + { + ServiceName = serviceName; + Action = action; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the service. Possible values include: + /// 'AutomaticRepairs' + /// + [JsonProperty(PropertyName = "serviceName")] + public string ServiceName { get; set; } + + /// + /// Gets or sets the action to be performed. Possible values include: + /// 'Resume', 'Suspend' + /// + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServiceName"); + } + if (Action == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Action"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceSummary.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceSummary.cs new file mode 100644 index 0000000000000..2f398484a9000 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationServiceSummary.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; + + /// + /// Summary for an orchestration service of a virtual machine scale set. + /// + public partial class OrchestrationServiceSummary + { + /// + /// Initializes a new instance of the OrchestrationServiceSummary + /// class. + /// + public OrchestrationServiceSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrchestrationServiceSummary + /// class. + /// + /// The name of the service. Possible values + /// include: 'AutomaticRepairs', + /// 'DummyOrchestrationServiceName' + /// The current state of the service. + /// Possible values include: 'NotRunning', 'Running', + /// 'Suspended' + public OrchestrationServiceSummary(string serviceName = default(string), string serviceState = default(string)) + { + ServiceName = serviceName; + ServiceState = serviceState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the service. Possible values include: + /// 'AutomaticRepairs' + /// + [JsonProperty(PropertyName = "serviceName")] + public string ServiceName { get; private set; } + + /// + /// Gets the current state of the service. Possible values include: + /// 'NotRunning', 'Running', 'Suspended' + /// + [JsonProperty(PropertyName = "serviceState")] + public string ServiceState { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Page.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..4476c5e85d422 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Page.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 Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Page1.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Page1.cs new file mode 100644 index 0000000000000..1b1a46379dcbb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Page1.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 Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PassNames.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PassNames.cs new file mode 100644 index 0000000000000..9e5d5e8bc3061 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PassNames.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for PassNames. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PassNames + { + [EnumMember(Value = "OobeSystem")] + OobeSystem + } + internal static class PassNamesEnumExtension + { + internal static string ToSerializedValue(this PassNames? value) + { + return value == null ? null : ((PassNames)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this PassNames value) + { + switch( value ) + { + case PassNames.OobeSystem: + return "OobeSystem"; + } + return null; + } + + internal static PassNames? ParsePassNames(this string value) + { + switch( value ) + { + case "OobeSystem": + return PassNames.OobeSystem; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchAssessmentState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchAssessmentState.cs new file mode 100644 index 0000000000000..e38d2040f7884 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchAssessmentState.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 PatchAssessmentState. + /// + public static class PatchAssessmentState + { + public const string Unknown = "Unknown"; + public const string Available = "Available"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationDetail.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationDetail.cs new file mode 100644 index 0000000000000..6dc51bd5402f2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationDetail.cs @@ -0,0 +1,104 @@ +// +// 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; + + /// + /// Information about a specific patch that was encountered during an + /// installation action. + /// + public partial class PatchInstallationDetail + { + /// + /// Initializes a new instance of the PatchInstallationDetail class. + /// + public PatchInstallationDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PatchInstallationDetail class. + /// + /// A unique identifier for the patch. + /// The friendly name of the patch. + /// The version string of the package. It may + /// conform to Semantic Versioning. Only applies to Linux. + /// The KBID of the patch. Only applies to Windows + /// patches. + /// The classification(s) of the patch as + /// provided by the patch publisher. + /// The state of the patch after the + /// installation operation completed. Possible values include: + /// 'Unknown', 'Installed', 'Failed', 'Excluded', 'NotSelected', + /// 'Pending' + public PatchInstallationDetail(string patchId = default(string), string name = default(string), string version = default(string), string kbId = default(string), IList classifications = default(IList), string installationState = default(string)) + { + PatchId = patchId; + Name = name; + Version = version; + KbId = kbId; + Classifications = classifications; + InstallationState = installationState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique identifier for the patch. + /// + [JsonProperty(PropertyName = "patchId")] + public string PatchId { get; private set; } + + /// + /// Gets the friendly name of the patch. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the version string of the package. It may conform to Semantic + /// Versioning. Only applies to Linux. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + /// + /// Gets the KBID of the patch. Only applies to Windows patches. + /// + [JsonProperty(PropertyName = "kbId")] + public string KbId { get; private set; } + + /// + /// Gets the classification(s) of the patch as provided by the patch + /// publisher. + /// + [JsonProperty(PropertyName = "classifications")] + public IList Classifications { get; private set; } + + /// + /// Gets the state of the patch after the installation operation + /// completed. Possible values include: 'Unknown', 'Installed', + /// 'Failed', 'Excluded', 'NotSelected', 'Pending' + /// + [JsonProperty(PropertyName = "installationState")] + public string InstallationState { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationState.cs new file mode 100644 index 0000000000000..6ca7103442bae --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationState.cs @@ -0,0 +1,26 @@ +// +// 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 PatchInstallationState. + /// + public static class PatchInstallationState + { + public const string Unknown = "Unknown"; + public const string Installed = "Installed"; + public const string Failed = "Failed"; + public const string Excluded = "Excluded"; + public const string NotSelected = "NotSelected"; + public const string Pending = "Pending"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchOperationStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchOperationStatus.cs new file mode 100644 index 0000000000000..0d9c96f755a18 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchOperationStatus.cs @@ -0,0 +1,25 @@ +// +// 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 PatchOperationStatus. + /// + public static class PatchOperationStatus + { + public const string Unknown = "Unknown"; + public const string InProgress = "InProgress"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + public const string CompletedWithWarnings = "CompletedWithWarnings"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirResource.cs new file mode 100644 index 0000000000000..7a1e494e0651c --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirSharedGalleryResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirSharedGalleryResource.cs new file mode 100644 index 0000000000000..1ee9785ad48c9 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Plan.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Plan.cs new file mode 100644 index 0000000000000..73554c036fdde --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Plan.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies information about the marketplace image used to create the + /// virtual machine. This element is only used for marketplace images. + /// Before you can use a marketplace image from an API, you must enable the + /// image for programmatic use. In the Azure portal, find the marketplace + /// image that you want to use and then click **Want to deploy + /// programmatically, Get Started ->**. Enter any required information + /// and then click **Save**. + /// + public partial class Plan + { + /// + /// Initializes a new instance of the Plan class. + /// + public Plan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Plan class. + /// + /// The plan ID. + /// The publisher ID. + /// Specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + /// The promotion code. + public Plan(string name = default(string), string publisher = default(string), string product = default(string), string promotionCode = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the plan ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher ID. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets the promotion code. + /// + [JsonProperty(PropertyName = "promotionCode")] + public string PromotionCode { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpoint.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 0000000000000..ef70805582420 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,51 @@ +// +// 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 Private Endpoint resource. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The ARM identifier for Private Endpoint + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ARM identifier for Private Endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnection.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 0000000000000..0937c63d601b2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,115 @@ +// +// 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; + + /// + /// The Private Endpoint Connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// A collection of + /// information about the state of the connection between DiskAccess + /// and Virtual Network. + /// The resource of private end + /// point. + /// The provisioning state of the + /// private endpoint connection resource. Possible values include: + /// 'Succeeded', 'Creating', 'Deleting', 'Failed' + /// private endpoint connection Id + /// private endpoint connection name + /// private endpoint connection type + public PrivateEndpointConnection(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string)) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource of private end point. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets a collection of information about the state of the + /// connection between DiskAccess and Virtual Network. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets the provisioning state of the private endpoint + /// connection resource. Possible values include: 'Succeeded', + /// 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets private endpoint connection Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets private endpoint connection name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets private endpoint connection type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateLinkServiceConnectionState"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 0000000000000..a5faa7278f6ff --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,24 @@ +// +// 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 PrivateEndpointConnectionProvisioningState. + /// + public static class PrivateEndpointConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 0000000000000..7563361c95558 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointServiceConnectionStatus.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 PrivateEndpointServiceConnectionStatus. + /// + public static class PrivateEndpointServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 0000000000000..5c8516507969c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,98 @@ +// +// 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; + + /// + /// A private link resource + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource DNS zone + /// name. + /// private link resource Id + /// private link resource name + /// private link resource type + public PrivateLinkResource(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList), string id = default(string), string name = default(string), string type = default(string)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets the private link resource DNS zone name. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + /// + /// Gets private link resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets private link resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets private link resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResourceListResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 0000000000000..74345e7246091 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResourceListResult.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; + + /// + /// A list of private link resources + /// + public partial class PrivateLinkResourceListResult + { + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + public PrivateLinkResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + /// Array of private link resources + public PrivateLinkResourceListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private link resources + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 0000000000000..fd42da8e37516 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -0,0 +1,77 @@ +// +// 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 collection of information about the state of the connection between + /// service consumer and provider. + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// Indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// The reason for approval/rejection of the + /// connection. + /// A message indicating if changes on + /// the service provider require any updates on the consumer. + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionsRequired = default(string)) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval/rejection of the connection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProtocolTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProtocolTypes.cs new file mode 100644 index 0000000000000..a8ac8d6cedb06 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProtocolTypes.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ProtocolTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ProtocolTypes + { + [EnumMember(Value = "Http")] + Http, + [EnumMember(Value = "Https")] + Https + } + internal static class ProtocolTypesEnumExtension + { + internal static string ToSerializedValue(this ProtocolTypes? value) + { + return value == null ? null : ((ProtocolTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ProtocolTypes value) + { + switch( value ) + { + case ProtocolTypes.Http: + return "Http"; + case ProtocolTypes.Https: + return "Https"; + } + return null; + } + + internal static ProtocolTypes? ParseProtocolTypes(this string value) + { + switch( value ) + { + case "Http": + return ProtocolTypes.Http; + case "Https": + return ProtocolTypes.Https; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroup.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroup.cs new file mode 100644 index 0000000000000..7094b0ae1144e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroup.cs @@ -0,0 +1,123 @@ +// +// 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 proximity placement group. + /// + [Rest.Serialization.JsonTransformation] + public partial class ProximityPlacementGroup : Resource + { + /// + /// Initializes a new instance of the ProximityPlacementGroup class. + /// + public ProximityPlacementGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProximityPlacementGroup class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Specifies the type of the + /// proximity placement group. <br><br> Possible values + /// are: <br><br> **Standard** : Co-locate resources within + /// an Azure region or Availability Zone. <br><br> + /// **Ultra** : For future use. Possible values include: 'Standard', + /// 'Ultra' + /// A list of references to all virtual + /// machines in the proximity placement group. + /// A list of references to all + /// virtual machine scale sets in the proximity placement + /// group. + /// A list of references to all + /// availability sets in the proximity placement group. + /// Describes colocation status of the + /// Proximity Placement Group. + public ProximityPlacementGroup(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string proximityPlacementGroupType = default(string), IList virtualMachines = default(IList), IList virtualMachineScaleSets = default(IList), IList availabilitySets = default(IList), InstanceViewStatus colocationStatus = default(InstanceViewStatus)) + : base(location, id, name, type, tags) + { + ProximityPlacementGroupType = proximityPlacementGroupType; + VirtualMachines = virtualMachines; + VirtualMachineScaleSets = virtualMachineScaleSets; + AvailabilitySets = availabilitySets; + ColocationStatus = colocationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the type of the proximity placement group. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Standard** : Co-locate + /// resources within an Azure region or Availability Zone. + /// &lt;br&gt;&lt;br&gt; **Ultra** : For future use. + /// Possible values include: 'Standard', 'Ultra' + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroupType")] + public string ProximityPlacementGroupType { get; set; } + + /// + /// Gets a list of references to all virtual machines in the proximity + /// placement group. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; private set; } + + /// + /// Gets a list of references to all virtual machine scale sets in the + /// proximity placement group. + /// + [JsonProperty(PropertyName = "properties.virtualMachineScaleSets")] + public IList VirtualMachineScaleSets { get; private set; } + + /// + /// Gets a list of references to all availability sets in the proximity + /// placement group. + /// + [JsonProperty(PropertyName = "properties.availabilitySets")] + public IList AvailabilitySets { get; private set; } + + /// + /// Gets or sets describes colocation status of the Proximity Placement + /// Group. + /// + [JsonProperty(PropertyName = "properties.colocationStatus")] + public InstanceViewStatus ColocationStatus { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroupType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroupType.cs new file mode 100644 index 0000000000000..9d5fc54330490 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroupType.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 ProximityPlacementGroupType. + /// + public static class ProximityPlacementGroupType + { + public const string Standard = "Standard"; + public const string Ultra = "Ultra"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroupUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroupUpdate.cs new file mode 100644 index 0000000000000..0343a07d68f68 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProximityPlacementGroupUpdate.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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the proximity placement group. + /// + public partial class ProximityPlacementGroupUpdate : UpdateResource + { + /// + /// Initializes a new instance of the ProximityPlacementGroupUpdate + /// class. + /// + public ProximityPlacementGroupUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProximityPlacementGroupUpdate + /// class. + /// + /// Resource tags + public ProximityPlacementGroupUpdate(IDictionary tags = default(IDictionary)) + : base(tags) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PurchasePlan.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PurchasePlan.cs new file mode 100644 index 0000000000000..ce30bb201ed97 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PurchasePlan.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Used for establishing the purchase context of any 3rd Party artifact + /// through MarketPlace. + /// + public partial class PurchasePlan + { + /// + /// Initializes a new instance of the PurchasePlan class. + /// + public PurchasePlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PurchasePlan class. + /// + /// The publisher ID. + /// The plan ID. + /// Specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + public PurchasePlan(string publisher, string name, string product) + { + Publisher = publisher; + Name = name; + Product = product; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the publisher ID. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the plan ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Product == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Product"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RecommendedMachineConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RecommendedMachineConfiguration.cs new file mode 100644 index 0000000000000..c4d67275d9985 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RecommendedMachineConfiguration.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 Newtonsoft.Json; + using System.Linq; + + /// + /// The properties describe the recommended machine configuration for this + /// Image Definition. These properties are updatable. + /// + public partial class RecommendedMachineConfiguration + { + /// + /// Initializes a new instance of the RecommendedMachineConfiguration + /// class. + /// + public RecommendedMachineConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedMachineConfiguration + /// class. + /// + public RecommendedMachineConfiguration(ResourceRange vCPUs = default(ResourceRange), ResourceRange memory = default(ResourceRange)) + { + VCPUs = vCPUs; + Memory = memory; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "vCPUs")] + public ResourceRange VCPUs { get; set; } + + /// + /// + [JsonProperty(PropertyName = "memory")] + public ResourceRange Memory { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RecoveryWalkResponse.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RecoveryWalkResponse.cs new file mode 100644 index 0000000000000..f72a34d7fe447 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RecoveryWalkResponse.cs @@ -0,0 +1,63 @@ +// +// 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; + + /// + /// Response after calling a manual recovery walk + /// + public partial class RecoveryWalkResponse + { + /// + /// Initializes a new instance of the RecoveryWalkResponse class. + /// + public RecoveryWalkResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecoveryWalkResponse class. + /// + /// Whether the recovery walk was + /// performed + /// The next update domain that + /// needs to be walked. Null means walk spanning all update domains has + /// been completed + public RecoveryWalkResponse(bool? walkPerformed = default(bool?), int? nextPlatformUpdateDomain = default(int?)) + { + WalkPerformed = walkPerformed; + NextPlatformUpdateDomain = nextPlatformUpdateDomain; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets whether the recovery walk was performed + /// + [JsonProperty(PropertyName = "walkPerformed")] + public bool? WalkPerformed { get; private set; } + + /// + /// Gets the next update domain that needs to be walked. Null means + /// walk spanning all update domains has been completed + /// + [JsonProperty(PropertyName = "nextPlatformUpdateDomain")] + public int? NextPlatformUpdateDomain { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RegionalReplicationStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RegionalReplicationStatus.cs new file mode 100644 index 0000000000000..a40af552a406e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RegionalReplicationStatus.cs @@ -0,0 +1,82 @@ +// +// 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; + + /// + /// This is the regional replication status. + /// + public partial class RegionalReplicationStatus + { + /// + /// Initializes a new instance of the RegionalReplicationStatus class. + /// + public RegionalReplicationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegionalReplicationStatus class. + /// + /// The region to which the gallery image version + /// is being replicated to. + /// This is the regional replication state. + /// Possible values include: 'Unknown', 'Replicating', 'Completed', + /// 'Failed' + /// The details of the replication + /// status. + /// It indicates progress of the replication + /// job. + public RegionalReplicationStatus(string region = default(string), string state = default(string), string details = default(string), int? progress = default(int?)) + { + Region = region; + State = state; + Details = details; + Progress = progress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the region to which the gallery image version is being + /// replicated to. + /// + [JsonProperty(PropertyName = "region")] + public string Region { get; private set; } + + /// + /// Gets this is the regional replication state. Possible values + /// include: 'Unknown', 'Replicating', 'Completed', 'Failed' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; private set; } + + /// + /// Gets the details of the replication status. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; private set; } + + /// + /// Gets it indicates progress of the replication job. + /// + [JsonProperty(PropertyName = "progress")] + public int? Progress { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationState.cs new file mode 100644 index 0000000000000..f7fc0b93a2886 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationState.cs @@ -0,0 +1,24 @@ +// +// 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 ReplicationState. + /// + public static class ReplicationState + { + public const string Unknown = "Unknown"; + public const string Replicating = "Replicating"; + public const string Completed = "Completed"; + public const string Failed = "Failed"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatus.cs new file mode 100644 index 0000000000000..5263ab5776131 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatus.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; + + /// + /// This is the replication status of the gallery image version. + /// + public partial class ReplicationStatus + { + /// + /// Initializes a new instance of the ReplicationStatus class. + /// + public ReplicationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplicationStatus class. + /// + /// This is the aggregated replication + /// status based on all the regional replication status flags. Possible + /// values include: 'Unknown', 'InProgress', 'Completed', + /// 'Failed' + /// This is a summary of replication status for + /// each region. + public ReplicationStatus(string aggregatedState = default(string), IList summary = default(IList)) + { + AggregatedState = aggregatedState; + Summary = summary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets this is the aggregated replication status based on all the + /// regional replication status flags. Possible values include: + /// 'Unknown', 'InProgress', 'Completed', 'Failed' + /// + [JsonProperty(PropertyName = "aggregatedState")] + public string AggregatedState { get; private set; } + + /// + /// Gets this is a summary of replication status for each region. + /// + [JsonProperty(PropertyName = "summary")] + public IList Summary { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatusTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatusTypes.cs new file mode 100644 index 0000000000000..5fc58962ffa14 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ReplicationStatusTypes.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 ReplicationStatusTypes. + /// + public static class ReplicationStatusTypes + { + public const string ReplicationStatus = "ReplicationStatus"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RequestRateByIntervalInput.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RequestRateByIntervalInput.cs new file mode 100644 index 0000000000000..994e73e9bd337 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RequestRateByIntervalInput.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Api request input for LogAnalytics getRequestRateByInterval Api. + /// + public partial class RequestRateByIntervalInput : LogAnalyticsInputBase + { + /// + /// Initializes a new instance of the RequestRateByIntervalInput class. + /// + public RequestRateByIntervalInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequestRateByIntervalInput class. + /// + /// SAS Uri of the logging blob + /// container to which LogAnalytics Api writes output logs to. + /// From time of the query + /// To time of the query + /// Interval value in minutes used to + /// create LogAnalytics call rate logs. Possible values include: + /// 'ThreeMins', 'FiveMins', 'ThirtyMins', 'SixtyMins' + /// Group query result by Throttle + /// Policy applied. + /// Group query result by Operation + /// 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) + { + IntervalLength = intervalLength; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets interval value in minutes used to create LogAnalytics + /// call rate logs. Possible values include: 'ThreeMins', 'FiveMins', + /// 'ThirtyMins', 'SixtyMins' + /// + [JsonProperty(PropertyName = "intervalLength")] + public IntervalInMins IntervalLength { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Resource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..ec2892fb8f545 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Resource.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + 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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceIdentityType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 0000000000000..fe0d168fb4cb9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned, + [EnumMember(Value = "UserAssigned")] + UserAssigned, + [EnumMember(Value = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + [EnumMember(Value = "None")] + None + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + case ResourceIdentityType.UserAssigned: + return "UserAssigned"; + case ResourceIdentityType.SystemAssignedUserAssigned: + return "SystemAssigned, UserAssigned"; + case ResourceIdentityType.None: + return "None"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + case "UserAssigned": + return ResourceIdentityType.UserAssigned; + case "SystemAssigned, UserAssigned": + return ResourceIdentityType.SystemAssignedUserAssigned; + case "None": + return ResourceIdentityType.None; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceRange.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceRange.cs new file mode 100644 index 0000000000000..e5a4447520823 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceRange.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 resource range. + /// + public partial class ResourceRange + { + /// + /// Initializes a new instance of the ResourceRange class. + /// + public ResourceRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceRange class. + /// + /// The minimum number of the resource. + /// The maximum number of the resource. + public ResourceRange(int? min = default(int?), int? max = default(int?)) + { + Min = min; + Max = max; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum number of the resource. + /// + [JsonProperty(PropertyName = "min")] + public int? Min { get; set; } + + /// + /// Gets or sets the maximum number of the resource. + /// + [JsonProperty(PropertyName = "max")] + public int? Max { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSku.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSku.cs new file mode 100644 index 0000000000000..c643ae3728b27 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSku.cs @@ -0,0 +1,165 @@ +// +// 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 an available Compute SKU. + /// + public partial class ResourceSku + { + /// + /// Initializes a new instance of the ResourceSku class. + /// + public ResourceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSku class. + /// + /// The type of resource the SKU applies + /// to. + /// The name of SKU. + /// Specifies the tier of virtual machines in a + /// scale set.<br /><br /> Possible Values:<br + /// /><br /> **Standard**<br /><br /> + /// **Basic** + /// The Size of the SKU. + /// The Family of this particular SKU. + /// The Kind of resources that are supported in this + /// SKU. + /// Specifies the number of virtual machines in + /// the scale set. + /// The set of locations that the SKU is + /// available. + /// A list of locations and availability + /// zones in those locations where the SKU is available. + /// The api versions that support this + /// SKU. + /// Metadata for retrieving price info. + /// A name value pair to describe the + /// capability. + /// The restrictions because of which SKU + /// cannot be used. This is empty if there are no restrictions. + public ResourceSku(string resourceType = default(string), string name = default(string), string tier = default(string), string size = default(string), string family = default(string), string kind = default(string), ResourceSkuCapacity capacity = default(ResourceSkuCapacity), IList locations = default(IList), IList locationInfo = default(IList), IList apiVersions = default(IList), IList costs = default(IList), IList capabilities = default(IList), IList restrictions = default(IList)) + { + ResourceType = resourceType; + Name = name; + Tier = tier; + Size = size; + Family = family; + Kind = kind; + Capacity = capacity; + Locations = locations; + LocationInfo = locationInfo; + ApiVersions = apiVersions; + Costs = costs; + Capabilities = capabilities; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of resource the SKU applies to. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets the name of SKU. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets specifies the tier of virtual machines in a scale + /// set.&lt;br /&gt;&lt;br /&gt; Possible + /// Values:&lt;br /&gt;&lt;br /&gt; + /// **Standard**&lt;br /&gt;&lt;br /&gt; **Basic** + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + /// + /// Gets the Size of the SKU. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; private set; } + + /// + /// Gets the Family of this particular SKU. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; private set; } + + /// + /// Gets the Kind of resources that are supported in this SKU. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets specifies the number of virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "capacity")] + public ResourceSkuCapacity Capacity { get; private set; } + + /// + /// Gets the set of locations that the SKU is available. + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets a list of locations and availability zones in those locations + /// where the SKU is available. + /// + [JsonProperty(PropertyName = "locationInfo")] + public IList LocationInfo { get; private set; } + + /// + /// Gets the api versions that support this SKU. + /// + [JsonProperty(PropertyName = "apiVersions")] + public IList ApiVersions { get; private set; } + + /// + /// Gets metadata for retrieving price info. + /// + [JsonProperty(PropertyName = "costs")] + public IList Costs { get; private set; } + + /// + /// Gets a name value pair to describe the capability. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + /// + /// Gets the restrictions because of which SKU cannot be used. This is + /// empty if there are no restrictions. + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapabilities.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapabilities.cs new file mode 100644 index 0000000000000..272bb901e726a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapabilities.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes The SKU capabilities object. + /// + public partial class ResourceSkuCapabilities + { + /// + /// Initializes a new instance of the ResourceSkuCapabilities class. + /// + public ResourceSkuCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuCapabilities class. + /// + /// An invariant to describe the feature. + /// An invariant if the feature is measured by + /// quantity. + public ResourceSkuCapabilities(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 an invariant to describe the feature. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets an invariant if the feature is measured by quantity. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapacity.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapacity.cs new file mode 100644 index 0000000000000..7ff7b7d0c818a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapacity.cs @@ -0,0 +1,77 @@ +// +// 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 scaling information of a SKU. + /// + public partial class ResourceSkuCapacity + { + /// + /// Initializes a new instance of the ResourceSkuCapacity class. + /// + public ResourceSkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuCapacity class. + /// + /// The minimum capacity. + /// The maximum capacity that can be set. + /// The default capacity. + /// The scale type applicable to the sku. + /// Possible values include: 'Automatic', 'Manual', 'None' + public ResourceSkuCapacity(long? minimum = default(long?), long? maximum = default(long?), long? defaultProperty = default(long?), ResourceSkuCapacityScaleType? scaleType = default(ResourceSkuCapacityScaleType?)) + { + Minimum = minimum; + Maximum = maximum; + DefaultProperty = defaultProperty; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the minimum capacity. + /// + [JsonProperty(PropertyName = "minimum")] + public long? Minimum { get; private set; } + + /// + /// Gets the maximum capacity that can be set. + /// + [JsonProperty(PropertyName = "maximum")] + public long? Maximum { get; private set; } + + /// + /// Gets the default capacity. + /// + [JsonProperty(PropertyName = "default")] + public long? DefaultProperty { get; private set; } + + /// + /// Gets the scale type applicable to the sku. Possible values include: + /// 'Automatic', 'Manual', 'None' + /// + [JsonProperty(PropertyName = "scaleType")] + public ResourceSkuCapacityScaleType? ScaleType { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapacityScaleType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapacityScaleType.cs new file mode 100644 index 0000000000000..cf50ce88d490b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCapacityScaleType.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceSkuCapacityScaleType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceSkuCapacityScaleType + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "Manual")] + Manual, + [EnumMember(Value = "None")] + None + } + internal static class ResourceSkuCapacityScaleTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceSkuCapacityScaleType? value) + { + return value == null ? null : ((ResourceSkuCapacityScaleType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceSkuCapacityScaleType value) + { + switch( value ) + { + case ResourceSkuCapacityScaleType.Automatic: + return "Automatic"; + case ResourceSkuCapacityScaleType.Manual: + return "Manual"; + case ResourceSkuCapacityScaleType.None: + return "None"; + } + return null; + } + + internal static ResourceSkuCapacityScaleType? ParseResourceSkuCapacityScaleType(this string value) + { + switch( value ) + { + case "Automatic": + return ResourceSkuCapacityScaleType.Automatic; + case "Manual": + return ResourceSkuCapacityScaleType.Manual; + case "None": + return ResourceSkuCapacityScaleType.None; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCosts.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCosts.cs new file mode 100644 index 0000000000000..6c0cbaaaceddd --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuCosts.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Describes metadata for retrieving price info. + /// + public partial class ResourceSkuCosts + { + /// + /// Initializes a new instance of the ResourceSkuCosts class. + /// + public ResourceSkuCosts() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuCosts class. + /// + /// Used for querying price from + /// commerce. + /// The multiplier is needed to extend the base + /// metered cost. + /// An invariant to show the extended + /// unit. + public ResourceSkuCosts(string meterID = default(string), long? quantity = default(long?), string extendedUnit = default(string)) + { + MeterID = meterID; + Quantity = quantity; + ExtendedUnit = extendedUnit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets used for querying price from commerce. + /// + [JsonProperty(PropertyName = "meterID")] + public string MeterID { get; private set; } + + /// + /// Gets the multiplier is needed to extend the base metered cost. + /// + [JsonProperty(PropertyName = "quantity")] + public long? Quantity { get; private set; } + + /// + /// Gets an invariant to show the extended unit. + /// + [JsonProperty(PropertyName = "extendedUnit")] + public string ExtendedUnit { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuLocationInfo.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuLocationInfo.cs new file mode 100644 index 0000000000000..2c487527fc18a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuLocationInfo.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; + + public partial class ResourceSkuLocationInfo + { + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + public ResourceSkuLocationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + /// Location of the SKU + /// List of availability zones where the SKU is + /// supported. + /// Details of capabilities available to a + /// SKU in specific zones. + public ResourceSkuLocationInfo(string location = default(string), IList zones = default(IList), IList zoneDetails = default(IList)) + { + Location = location; + Zones = zones; + ZoneDetails = zoneDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the SKU + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets list of availability zones where the SKU is supported. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + /// + /// Gets details of capabilities available to a SKU in specific zones. + /// + [JsonProperty(PropertyName = "zoneDetails")] + public IList ZoneDetails { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionInfo.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionInfo.cs new file mode 100644 index 0000000000000..c3e9037998438 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionInfo.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class ResourceSkuRestrictionInfo + { + /// + /// Initializes a new instance of the ResourceSkuRestrictionInfo class. + /// + public ResourceSkuRestrictionInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuRestrictionInfo class. + /// + /// Locations where the SKU is + /// restricted + /// List of availability zones where the SKU is + /// restricted. + public ResourceSkuRestrictionInfo(IList locations = default(IList), IList zones = default(IList)) + { + Locations = locations; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets locations where the SKU is restricted + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets list of availability zones where the SKU is restricted. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictions.cs new file mode 100644 index 0000000000000..46a7fb12e40d4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictions.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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes scaling information of a SKU. + /// + public partial class ResourceSkuRestrictions + { + /// + /// Initializes a new instance of the ResourceSkuRestrictions class. + /// + public ResourceSkuRestrictions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuRestrictions class. + /// + /// The type of restrictions. Possible values + /// include: 'Location', 'Zone' + /// The value of restrictions. If the restriction + /// type is set to location. This would be different locations where + /// the SKU is restricted. + /// The information about the restriction + /// where the SKU cannot be used. + /// The reason for restriction. Possible + /// values include: 'QuotaId', 'NotAvailableForSubscription' + public ResourceSkuRestrictions(ResourceSkuRestrictionsType? type = default(ResourceSkuRestrictionsType?), IList values = default(IList), ResourceSkuRestrictionInfo restrictionInfo = default(ResourceSkuRestrictionInfo), ResourceSkuRestrictionsReasonCode? reasonCode = default(ResourceSkuRestrictionsReasonCode?)) + { + Type = type; + Values = values; + RestrictionInfo = restrictionInfo; + ReasonCode = reasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of restrictions. Possible values include: 'Location', + /// 'Zone' + /// + [JsonProperty(PropertyName = "type")] + public ResourceSkuRestrictionsType? Type { get; private set; } + + /// + /// Gets the value of restrictions. If the restriction type is set to + /// location. This would be different locations where the SKU is + /// restricted. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; private set; } + + /// + /// Gets the information about the restriction where the SKU cannot be + /// used. + /// + [JsonProperty(PropertyName = "restrictionInfo")] + public ResourceSkuRestrictionInfo RestrictionInfo { get; private set; } + + /// + /// Gets the reason for restriction. Possible values include: + /// 'QuotaId', 'NotAvailableForSubscription' + /// + [JsonProperty(PropertyName = "reasonCode")] + public ResourceSkuRestrictionsReasonCode? ReasonCode { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs new file mode 100644 index 0000000000000..2cf4b4bc828f4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceSkuRestrictionsReasonCode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceSkuRestrictionsReasonCode + { + [EnumMember(Value = "QuotaId")] + QuotaId, + [EnumMember(Value = "NotAvailableForSubscription")] + NotAvailableForSubscription + } + internal static class ResourceSkuRestrictionsReasonCodeEnumExtension + { + internal static string ToSerializedValue(this ResourceSkuRestrictionsReasonCode? value) + { + return value == null ? null : ((ResourceSkuRestrictionsReasonCode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceSkuRestrictionsReasonCode value) + { + switch( value ) + { + case ResourceSkuRestrictionsReasonCode.QuotaId: + return "QuotaId"; + case ResourceSkuRestrictionsReasonCode.NotAvailableForSubscription: + return "NotAvailableForSubscription"; + } + return null; + } + + internal static ResourceSkuRestrictionsReasonCode? ParseResourceSkuRestrictionsReasonCode(this string value) + { + switch( value ) + { + case "QuotaId": + return ResourceSkuRestrictionsReasonCode.QuotaId; + case "NotAvailableForSubscription": + return ResourceSkuRestrictionsReasonCode.NotAvailableForSubscription; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionsType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionsType.cs new file mode 100644 index 0000000000000..220256fb869d9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuRestrictionsType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceSkuRestrictionsType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceSkuRestrictionsType + { + [EnumMember(Value = "Location")] + Location, + [EnumMember(Value = "Zone")] + Zone + } + internal static class ResourceSkuRestrictionsTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceSkuRestrictionsType? value) + { + return value == null ? null : ((ResourceSkuRestrictionsType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceSkuRestrictionsType value) + { + switch( value ) + { + case ResourceSkuRestrictionsType.Location: + return "Location"; + case ResourceSkuRestrictionsType.Zone: + return "Zone"; + } + return null; + } + + internal static ResourceSkuRestrictionsType? ParseResourceSkuRestrictionsType(this string value) + { + switch( value ) + { + case "Location": + return ResourceSkuRestrictionsType.Location; + case "Zone": + return ResourceSkuRestrictionsType.Zone; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuZoneDetails.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuZoneDetails.cs new file mode 100644 index 0000000000000..fa00779641712 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceSkuZoneDetails.cs @@ -0,0 +1,65 @@ +// +// 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 zonal capabilities of a SKU. + /// + public partial class ResourceSkuZoneDetails + { + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + public ResourceSkuZoneDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + /// The set of zones that the SKU is available in + /// with the specified capabilities. + /// A list of capabilities that are + /// available for the SKU in the specified list of zones. + public ResourceSkuZoneDetails(IList name = default(IList), IList capabilities = default(IList)) + { + Name = name; + Capabilities = capabilities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the set of zones that the SKU is available in with the + /// specified capabilities. + /// + [JsonProperty(PropertyName = "name")] + public IList Name { get; private set; } + + /// + /// Gets a list of capabilities that are available for the SKU in the + /// specified list of zones. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.cs new file mode 100644 index 0000000000000..2aa19f2cb654f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.cs @@ -0,0 +1,63 @@ +// +// 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 SAS URIs of the console screenshot and serial log blobs. + /// + public partial class RetrieveBootDiagnosticsDataResult + { + /// + /// Initializes a new instance of the RetrieveBootDiagnosticsDataResult + /// class. + /// + public RetrieveBootDiagnosticsDataResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RetrieveBootDiagnosticsDataResult + /// class. + /// + /// The console screenshot blob + /// URI + /// The serial console log blob + /// URI. + public RetrieveBootDiagnosticsDataResult(string consoleScreenshotBlobUri = default(string), string serialConsoleLogBlobUri = default(string)) + { + ConsoleScreenshotBlobUri = consoleScreenshotBlobUri; + SerialConsoleLogBlobUri = serialConsoleLogBlobUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the console screenshot blob URI + /// + [JsonProperty(PropertyName = "consoleScreenshotBlobUri")] + public string ConsoleScreenshotBlobUri { get; private set; } + + /// + /// Gets the serial console log blob URI. + /// + [JsonProperty(PropertyName = "serialConsoleLogBlobUri")] + public string SerialConsoleLogBlobUri { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollbackStatusInfo.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollbackStatusInfo.cs new file mode 100644 index 0000000000000..e68e9792dc382 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollbackStatusInfo.cs @@ -0,0 +1,72 @@ +// +// 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; + + /// + /// Information about rollback on failed VM instances after a OS Upgrade + /// operation. + /// + public partial class RollbackStatusInfo + { + /// + /// Initializes a new instance of the RollbackStatusInfo class. + /// + public RollbackStatusInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollbackStatusInfo class. + /// + /// The number of + /// instances which have been successfully rolled back. + /// The number of instances + /// which failed to rollback. + /// Error details if OS rollback + /// failed. + public RollbackStatusInfo(int? successfullyRolledbackInstanceCount = default(int?), int? failedRolledbackInstanceCount = default(int?), ApiError rollbackError = default(ApiError)) + { + SuccessfullyRolledbackInstanceCount = successfullyRolledbackInstanceCount; + FailedRolledbackInstanceCount = failedRolledbackInstanceCount; + RollbackError = rollbackError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the number of instances which have been successfully rolled + /// back. + /// + [JsonProperty(PropertyName = "successfullyRolledbackInstanceCount")] + public int? SuccessfullyRolledbackInstanceCount { get; private set; } + + /// + /// Gets the number of instances which failed to rollback. + /// + [JsonProperty(PropertyName = "failedRolledbackInstanceCount")] + public int? FailedRolledbackInstanceCount { get; private set; } + + /// + /// Gets error details if OS rollback failed. + /// + [JsonProperty(PropertyName = "rollbackError")] + public ApiError RollbackError { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeActionType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeActionType.cs new file mode 100644 index 0000000000000..7e3c4f93c1c19 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeActionType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RollingUpgradeActionType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RollingUpgradeActionType + { + [EnumMember(Value = "Start")] + Start, + [EnumMember(Value = "Cancel")] + Cancel + } + internal static class RollingUpgradeActionTypeEnumExtension + { + internal static string ToSerializedValue(this RollingUpgradeActionType? value) + { + return value == null ? null : ((RollingUpgradeActionType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RollingUpgradeActionType value) + { + switch( value ) + { + case RollingUpgradeActionType.Start: + return "Start"; + case RollingUpgradeActionType.Cancel: + return "Cancel"; + } + return null; + } + + internal static RollingUpgradeActionType? ParseRollingUpgradeActionType(this string value) + { + switch( value ) + { + case "Start": + return RollingUpgradeActionType.Start; + case "Cancel": + return RollingUpgradeActionType.Cancel; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradePolicy.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradePolicy.cs new file mode 100644 index 0000000000000..cf56aac6c64fe --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradePolicy.cs @@ -0,0 +1,167 @@ +// +// 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; + + /// + /// The configuration parameters used while performing a rolling upgrade. + /// + public partial class RollingUpgradePolicy + { + /// + /// Initializes a new instance of the RollingUpgradePolicy class. + /// + public RollingUpgradePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradePolicy class. + /// + /// The maximum percent of total + /// virtual machine instances that will be upgraded simultaneously by + /// the rolling upgrade in one batch. As this is a maximum, unhealthy + /// instances in previous or future batches can cause the percentage of + /// instances in a batch to decrease to ensure higher reliability. The + /// default value for this parameter is 20%. + /// The maximum percentage of + /// the total virtual machine instances in the scale set that can be + /// simultaneously unhealthy, either as a result of being upgraded, or + /// by being found in an unhealthy state by the virtual machine health + /// checks before the rolling upgrade aborts. This constraint will be + /// checked prior to starting any batch. The default value for this + /// parameter is 20%. + /// The maximum + /// percentage of upgraded virtual machine instances that can be found + /// to be in an unhealthy state. This check will happen after each + /// batch is upgraded. If this percentage is ever exceeded, the rolling + /// update aborts. The default value for this parameter is 20%. + /// The wait time between + /// completing the update for all virtual machines in one batch and + /// starting the next batch. The time duration should be specified in + /// ISO 8601 format. The default value is 0 seconds (PT0S). + /// Allow VMSS to ignore AZ + /// boundaries when constructing upgrade batches. Take into + /// consideration the Update Domain and maxBatchInstancePercent to + /// determine the batch size. + /// Upgrade all unhealthy + /// instances in a scale set before any healthy instances. + public RollingUpgradePolicy(int? maxBatchInstancePercent = default(int?), int? maxUnhealthyInstancePercent = default(int?), int? maxUnhealthyUpgradedInstancePercent = default(int?), string pauseTimeBetweenBatches = default(string), bool? enableCrossZoneUpgrade = default(bool?), bool? prioritizeUnhealthyInstances = default(bool?)) + { + MaxBatchInstancePercent = maxBatchInstancePercent; + MaxUnhealthyInstancePercent = maxUnhealthyInstancePercent; + MaxUnhealthyUpgradedInstancePercent = maxUnhealthyUpgradedInstancePercent; + PauseTimeBetweenBatches = pauseTimeBetweenBatches; + EnableCrossZoneUpgrade = enableCrossZoneUpgrade; + PrioritizeUnhealthyInstances = prioritizeUnhealthyInstances; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the maximum percent of total virtual machine instances + /// that will be upgraded simultaneously by the rolling upgrade in one + /// batch. As this is a maximum, unhealthy instances in previous or + /// future batches can cause the percentage of instances in a batch to + /// decrease to ensure higher reliability. The default value for this + /// parameter is 20%. + /// + [JsonProperty(PropertyName = "maxBatchInstancePercent")] + public int? MaxBatchInstancePercent { get; set; } + + /// + /// Gets or sets the maximum percentage of the total virtual machine + /// instances in the scale set that can be simultaneously unhealthy, + /// either as a result of being upgraded, or by being found in an + /// unhealthy state by the virtual machine health checks before the + /// rolling upgrade aborts. This constraint will be checked prior to + /// starting any batch. The default value for this parameter is 20%. + /// + [JsonProperty(PropertyName = "maxUnhealthyInstancePercent")] + public int? MaxUnhealthyInstancePercent { get; set; } + + /// + /// Gets or sets the maximum percentage of upgraded virtual machine + /// instances that can be found to be in an unhealthy state. This check + /// will happen after each batch is upgraded. If this percentage is + /// ever exceeded, the rolling update aborts. The default value for + /// this parameter is 20%. + /// + [JsonProperty(PropertyName = "maxUnhealthyUpgradedInstancePercent")] + public int? MaxUnhealthyUpgradedInstancePercent { get; set; } + + /// + /// Gets or sets the wait time between completing the update for all + /// virtual machines in one batch and starting the next batch. The time + /// duration should be specified in ISO 8601 format. The default value + /// is 0 seconds (PT0S). + /// + [JsonProperty(PropertyName = "pauseTimeBetweenBatches")] + public string PauseTimeBetweenBatches { get; set; } + + /// + /// Gets or sets allow VMSS to ignore AZ boundaries when constructing + /// upgrade batches. Take into consideration the Update Domain and + /// maxBatchInstancePercent to determine the batch size. + /// + [JsonProperty(PropertyName = "enableCrossZoneUpgrade")] + public bool? EnableCrossZoneUpgrade { get; set; } + + /// + /// Gets or sets upgrade all unhealthy instances in a scale set before + /// any healthy instances. + /// + [JsonProperty(PropertyName = "prioritizeUnhealthyInstances")] + public bool? PrioritizeUnhealthyInstances { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MaxBatchInstancePercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxBatchInstancePercent", 100); + } + if (MaxBatchInstancePercent < 5) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxBatchInstancePercent", 5); + } + if (MaxUnhealthyInstancePercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxUnhealthyInstancePercent", 100); + } + if (MaxUnhealthyInstancePercent < 5) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxUnhealthyInstancePercent", 5); + } + if (MaxUnhealthyUpgradedInstancePercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxUnhealthyUpgradedInstancePercent", 100); + } + if (MaxUnhealthyUpgradedInstancePercent < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxUnhealthyUpgradedInstancePercent", 0); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeProgressInfo.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeProgressInfo.cs new file mode 100644 index 0000000000000..ba26df8d454d0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeProgressInfo.cs @@ -0,0 +1,82 @@ +// +// 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; + + /// + /// Information about the number of virtual machine instances in each + /// upgrade state. + /// + public partial class RollingUpgradeProgressInfo + { + /// + /// Initializes a new instance of the RollingUpgradeProgressInfo class. + /// + public RollingUpgradeProgressInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradeProgressInfo class. + /// + /// The number of instances that + /// have been successfully upgraded. + /// The number of instances that have + /// failed to be upgraded successfully. + /// The number of instances that + /// are currently being upgraded. + /// The number of instances that + /// have not yet begun to be upgraded. + public RollingUpgradeProgressInfo(int? successfulInstanceCount = default(int?), int? failedInstanceCount = default(int?), int? inProgressInstanceCount = default(int?), int? pendingInstanceCount = default(int?)) + { + SuccessfulInstanceCount = successfulInstanceCount; + FailedInstanceCount = failedInstanceCount; + InProgressInstanceCount = inProgressInstanceCount; + PendingInstanceCount = pendingInstanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the number of instances that have been successfully upgraded. + /// + [JsonProperty(PropertyName = "successfulInstanceCount")] + public int? SuccessfulInstanceCount { get; private set; } + + /// + /// Gets the number of instances that have failed to be upgraded + /// successfully. + /// + [JsonProperty(PropertyName = "failedInstanceCount")] + public int? FailedInstanceCount { get; private set; } + + /// + /// Gets the number of instances that are currently being upgraded. + /// + [JsonProperty(PropertyName = "inProgressInstanceCount")] + public int? InProgressInstanceCount { get; private set; } + + /// + /// Gets the number of instances that have not yet begun to be + /// upgraded. + /// + [JsonProperty(PropertyName = "pendingInstanceCount")] + public int? PendingInstanceCount { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeRunningStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeRunningStatus.cs new file mode 100644 index 0000000000000..86014bd5619a7 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeRunningStatus.cs @@ -0,0 +1,84 @@ +// +// 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; + + /// + /// Information about the current running state of the overall upgrade. + /// + public partial class RollingUpgradeRunningStatus + { + /// + /// Initializes a new instance of the RollingUpgradeRunningStatus + /// class. + /// + public RollingUpgradeRunningStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradeRunningStatus + /// class. + /// + /// Code indicating the current status of the + /// upgrade. Possible values include: 'RollingForward', 'Cancelled', + /// 'Completed', 'Faulted' + /// Start time of the upgrade. + /// The last action performed on the rolling + /// upgrade. Possible values include: 'Start', 'Cancel' + /// Last action time of the + /// upgrade. + public RollingUpgradeRunningStatus(RollingUpgradeStatusCode? code = default(RollingUpgradeStatusCode?), System.DateTime? startTime = default(System.DateTime?), RollingUpgradeActionType? lastAction = default(RollingUpgradeActionType?), System.DateTime? lastActionTime = default(System.DateTime?)) + { + Code = code; + StartTime = startTime; + LastAction = lastAction; + LastActionTime = lastActionTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets code indicating the current status of the upgrade. Possible + /// values include: 'RollingForward', 'Cancelled', 'Completed', + /// 'Faulted' + /// + [JsonProperty(PropertyName = "code")] + public RollingUpgradeStatusCode? Code { get; private set; } + + /// + /// Gets start time of the upgrade. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the last action performed on the rolling upgrade. Possible + /// values include: 'Start', 'Cancel' + /// + [JsonProperty(PropertyName = "lastAction")] + public RollingUpgradeActionType? LastAction { get; private set; } + + /// + /// Gets last action time of the upgrade. + /// + [JsonProperty(PropertyName = "lastActionTime")] + public System.DateTime? LastActionTime { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeStatusCode.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeStatusCode.cs new file mode 100644 index 0000000000000..9e108e8c1d93c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeStatusCode.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RollingUpgradeStatusCode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RollingUpgradeStatusCode + { + [EnumMember(Value = "RollingForward")] + RollingForward, + [EnumMember(Value = "Cancelled")] + Cancelled, + [EnumMember(Value = "Completed")] + Completed, + [EnumMember(Value = "Faulted")] + Faulted + } + internal static class RollingUpgradeStatusCodeEnumExtension + { + internal static string ToSerializedValue(this RollingUpgradeStatusCode? value) + { + return value == null ? null : ((RollingUpgradeStatusCode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RollingUpgradeStatusCode value) + { + switch( value ) + { + case RollingUpgradeStatusCode.RollingForward: + return "RollingForward"; + case RollingUpgradeStatusCode.Cancelled: + return "Cancelled"; + case RollingUpgradeStatusCode.Completed: + return "Completed"; + case RollingUpgradeStatusCode.Faulted: + return "Faulted"; + } + return null; + } + + internal static RollingUpgradeStatusCode? ParseRollingUpgradeStatusCode(this string value) + { + switch( value ) + { + case "RollingForward": + return RollingUpgradeStatusCode.RollingForward; + case "Cancelled": + return RollingUpgradeStatusCode.Cancelled; + case "Completed": + return RollingUpgradeStatusCode.Completed; + case "Faulted": + return RollingUpgradeStatusCode.Faulted; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeStatusInfo.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeStatusInfo.cs new file mode 100644 index 0000000000000..7c9078046b69c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradeStatusInfo.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.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The status of the latest virtual machine scale set rolling upgrade. + /// + [Rest.Serialization.JsonTransformation] + public partial class RollingUpgradeStatusInfo : Resource + { + /// + /// Initializes a new instance of the RollingUpgradeStatusInfo class. + /// + public RollingUpgradeStatusInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradeStatusInfo class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The rolling upgrade policies applied for this + /// upgrade. + /// Information about the current running + /// state of the overall upgrade. + /// Information about the number of virtual + /// machine instances in each upgrade state. + /// Error details for this upgrade, if there are + /// any. + public RollingUpgradeStatusInfo(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), RollingUpgradePolicy policy = default(RollingUpgradePolicy), RollingUpgradeRunningStatus runningStatus = default(RollingUpgradeRunningStatus), RollingUpgradeProgressInfo progress = default(RollingUpgradeProgressInfo), ApiError error = default(ApiError)) + : base(location, id, name, type, tags) + { + Policy = policy; + RunningStatus = runningStatus; + Progress = progress; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the rolling upgrade policies applied for this upgrade. + /// + [JsonProperty(PropertyName = "properties.policy")] + public RollingUpgradePolicy Policy { get; private set; } + + /// + /// Gets information about the current running state of the overall + /// upgrade. + /// + [JsonProperty(PropertyName = "properties.runningStatus")] + public RollingUpgradeRunningStatus RunningStatus { get; private set; } + + /// + /// Gets information about the number of virtual machine instances in + /// each upgrade state. + /// + [JsonProperty(PropertyName = "properties.progress")] + public RollingUpgradeProgressInfo Progress { get; private set; } + + /// + /// Gets error details for this upgrade, if there are any. + /// + [JsonProperty(PropertyName = "properties.error")] + public ApiError Error { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Policy != null) + { + Policy.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandDocument.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandDocument.cs new file mode 100644 index 0000000000000..d882f8dce44d3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandDocument.cs @@ -0,0 +1,93 @@ +// +// 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; + + /// + /// Describes the properties of a Run Command. + /// + public partial class RunCommandDocument : RunCommandDocumentBase + { + /// + /// Initializes a new instance of the RunCommandDocument class. + /// + public RunCommandDocument() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandDocument class. + /// + /// The VM run command schema. + /// The VM run command id. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The VM run command label. + /// The VM run command description. + /// The script to be executed. + /// The parameters used by the script. + public RunCommandDocument(string schema, string id, OperatingSystemTypes osType, string label, string description, IList script, IList parameters = default(IList)) + : base(schema, id, osType, label, description) + { + Script = script; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the script to be executed. + /// + [JsonProperty(PropertyName = "script")] + public IList Script { get; set; } + + /// + /// Gets or sets the parameters used by the script. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Script == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Script"); + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandDocumentBase.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandDocumentBase.cs new file mode 100644 index 0000000000000..b80e0ea65ef4e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandDocumentBase.cs @@ -0,0 +1,111 @@ +// +// 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; + + /// + /// Describes the properties of a Run Command metadata. + /// + public partial class RunCommandDocumentBase + { + /// + /// Initializes a new instance of the RunCommandDocumentBase class. + /// + public RunCommandDocumentBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandDocumentBase class. + /// + /// The VM run command schema. + /// The VM run command id. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The VM run command label. + /// The VM run command description. + public RunCommandDocumentBase(string schema, string id, OperatingSystemTypes osType, string label, string description) + { + Schema = schema; + Id = id; + OsType = osType; + Label = label; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the VM run command schema. + /// + [JsonProperty(PropertyName = "$schema")] + public string Schema { get; set; } + + /// + /// Gets or sets the VM run command id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets the VM run command label. + /// + [JsonProperty(PropertyName = "label")] + public string Label { get; set; } + + /// + /// Gets or sets the VM run command description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schema"); + } + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + if (Label == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Label"); + } + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandInput.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandInput.cs new file mode 100644 index 0000000000000..ab1225bcb8351 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandInput.cs @@ -0,0 +1,97 @@ +// +// 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; + + /// + /// Capture Virtual Machine parameters. + /// + public partial class RunCommandInput + { + /// + /// Initializes a new instance of the RunCommandInput class. + /// + public RunCommandInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandInput class. + /// + /// The run command id. + /// Optional. The script to be executed. When + /// this value is given, the given script will override the default + /// script of the command. + /// The run command parameters. + public RunCommandInput(string commandId, IList script = default(IList), IList parameters = default(IList)) + { + CommandId = commandId; + Script = script; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the run command id. + /// + [JsonProperty(PropertyName = "commandId")] + public string CommandId { get; set; } + + /// + /// Gets or sets optional. The script to be executed. When this value + /// is given, the given script will override the default script of the + /// command. + /// + [JsonProperty(PropertyName = "script")] + public IList Script { get; set; } + + /// + /// Gets or sets the run command parameters. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CommandId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CommandId"); + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandInputParameter.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandInputParameter.cs new file mode 100644 index 0000000000000..0b652e9085753 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandInputParameter.cs @@ -0,0 +1,77 @@ +// +// 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; + + /// + /// Describes the properties of a run command parameter. + /// + public partial class RunCommandInputParameter + { + /// + /// Initializes a new instance of the RunCommandInputParameter class. + /// + public RunCommandInputParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandInputParameter class. + /// + /// The run command parameter name. + /// The run command parameter value. + public RunCommandInputParameter(string name, string value) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the run command parameter name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the run command parameter value. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandParameterDefinition.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandParameterDefinition.cs new file mode 100644 index 0000000000000..b8acb1f1288af --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandParameterDefinition.cs @@ -0,0 +1,96 @@ +// +// 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; + + /// + /// Describes the properties of a run command parameter. + /// + public partial class RunCommandParameterDefinition + { + /// + /// Initializes a new instance of the RunCommandParameterDefinition + /// class. + /// + public RunCommandParameterDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandParameterDefinition + /// class. + /// + /// The run command parameter name. + /// The run command parameter type. + /// The run command parameter default + /// value. + /// The run command parameter required. + public RunCommandParameterDefinition(string name, string type, string defaultValue = default(string), bool? required = default(bool?)) + { + Name = name; + Type = type; + DefaultValue = defaultValue; + Required = required; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the run command parameter name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the run command parameter type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the run command parameter default value. + /// + [JsonProperty(PropertyName = "defaultValue")] + public string DefaultValue { get; set; } + + /// + /// Gets or sets the run command parameter required. + /// + [JsonProperty(PropertyName = "required")] + public bool? Required { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandResult.cs new file mode 100644 index 0000000000000..0bbd028fe22de --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunCommandResult.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 RunCommandResult + { + /// + /// Initializes a new instance of the RunCommandResult class. + /// + public RunCommandResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandResult class. + /// + /// Run command operation response. + public RunCommandResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets run command operation response. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs new file mode 100644 index 0000000000000..894e661e2ff56 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs @@ -0,0 +1,92 @@ +// +// 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 scale-in policy for a virtual machine scale set. + /// + public partial class ScaleInPolicy + { + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + public ScaleInPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + /// The rules to be followed when scaling-in a + /// virtual machine scale set. <br><br> Possible values + /// are: <br><br> **Default** When a virtual machine scale + /// set is scaled in, the scale set will first be balanced across zones + /// if it is a zonal scale set. Then, it will be balanced across Fault + /// Domains as far as possible. Within each Fault Domain, the virtual + /// machines chosen for removal will be the newest ones that are not + /// protected from scale-in. <br><br> **OldestVM** When a + /// virtual machine scale set is being scaled-in, the oldest virtual + /// machines that are not protected from scale-in will be chosen for + /// removal. For zonal virtual machine scale sets, the scale set will + /// first be balanced across zones. Within each zone, the oldest + /// virtual machines that are not protected will be chosen for removal. + /// <br><br> **NewestVM** When a virtual machine scale set + /// is being scaled-in, the newest virtual machines that are not + /// protected from scale-in will be chosen for removal. For zonal + /// virtual machine scale sets, the scale set will first be balanced + /// across zones. Within each zone, the newest virtual machines that + /// are not protected will be chosen for removal. + /// <br><br> + public ScaleInPolicy(IList rules = default(IList)) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rules to be followed when scaling-in a virtual + /// machine scale set. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; **Default** When a + /// virtual machine scale set is scaled in, the scale set will first be + /// balanced across zones if it is a zonal scale set. Then, it will be + /// balanced across Fault Domains as far as possible. Within each Fault + /// Domain, the virtual machines chosen for removal will be the newest + /// ones that are not protected from scale-in. + /// &lt;br&gt;&lt;br&gt; **OldestVM** When a virtual + /// machine scale set is being scaled-in, the oldest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the oldest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; **NewestVM** When a virtual + /// machine scale set is being scaled-in, the newest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the newest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScheduledEventsProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScheduledEventsProfile.cs new file mode 100644 index 0000000000000..adb596896ddba --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScheduledEventsProfile.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 ScheduledEventsProfile + { + /// + /// Initializes a new instance of the ScheduledEventsProfile class. + /// + public ScheduledEventsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduledEventsProfile class. + /// + /// Specifies Terminate + /// Scheduled Event related configurations. + public ScheduledEventsProfile(TerminateNotificationProfile terminateNotificationProfile = default(TerminateNotificationProfile)) + { + TerminateNotificationProfile = terminateNotificationProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies Terminate Scheduled Event related + /// configurations. + /// + [JsonProperty(PropertyName = "terminateNotificationProfile")] + public TerminateNotificationProfile TerminateNotificationProfile { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityProfile.cs new file mode 100644 index 0000000000000..0be80d5c515a1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityProfile.cs @@ -0,0 +1,92 @@ +// +// 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; + + /// + /// Specifies the Security profile settings for the virtual machine or + /// virtual machine scale set. + /// + public partial class SecurityProfile + { + /// + /// Initializes a new instance of the SecurityProfile class. + /// + public SecurityProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityProfile class. + /// + /// Specifies the security settings like + /// secure boot and vTPM used while creating the virtual machine. + /// <br><br>Minimum api-version: 2020-12-01 + /// This property can be used by user in + /// the request to enable or disable the Host Encryption for the + /// virtual machine or virtual machine scale set. This will enable the + /// encryption for all the disks including Resource/Temp disk at host + /// itself. <br><br> Default: The Encryption at host will + /// be disabled unless this property is set to true for the + /// resource. + /// Specifies the SecurityType of the + /// virtual machine. It is set as TrustedLaunch to enable UefiSettings. + /// <br><br> Default: UefiSettings will not be enabled + /// unless this property is set as TrustedLaunch. Possible values + /// include: 'TrustedLaunch' + public SecurityProfile(UefiSettings uefiSettings = default(UefiSettings), bool? encryptionAtHost = default(bool?), SecurityTypes? securityType = default(SecurityTypes?)) + { + UefiSettings = uefiSettings; + EncryptionAtHost = encryptionAtHost; + SecurityType = securityType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the security settings like secure boot and + /// vTPM used while creating the virtual machine. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: 2020-12-01 + /// + [JsonProperty(PropertyName = "uefiSettings")] + public UefiSettings UefiSettings { get; set; } + + /// + /// Gets or sets this property can be used by user in the request to + /// enable or disable the Host Encryption for the virtual machine or + /// virtual machine scale set. This will enable the encryption for all + /// the disks including Resource/Temp disk at host itself. + /// &lt;br&gt;&lt;br&gt; Default: The Encryption at + /// host will be disabled unless this property is set to true for the + /// resource. + /// + [JsonProperty(PropertyName = "encryptionAtHost")] + public bool? EncryptionAtHost { get; set; } + + /// + /// Gets or sets specifies the SecurityType of the virtual machine. It + /// is set as TrustedLaunch to enable UefiSettings. + /// &lt;br&gt;&lt;br&gt; Default: UefiSettings will not + /// be enabled unless this property is set as TrustedLaunch. Possible + /// values include: 'TrustedLaunch' + /// + [JsonProperty(PropertyName = "securityType")] + public SecurityTypes? SecurityType { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityTypes.cs new file mode 100644 index 0000000000000..aad5bca9275b7 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityTypes.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SecurityTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SecurityTypes + { + [EnumMember(Value = "TrustedLaunch")] + TrustedLaunch + } + internal static class SecurityTypesEnumExtension + { + internal static string ToSerializedValue(this SecurityTypes? value) + { + return value == null ? null : ((SecurityTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SecurityTypes value) + { + switch( value ) + { + case SecurityTypes.TrustedLaunch: + return "TrustedLaunch"; + } + return null; + } + + internal static SecurityTypes? ParseSecurityTypes(this string value) + { + switch( value ) + { + case "TrustedLaunch": + return SecurityTypes.TrustedLaunch; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SelectPermissions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SelectPermissions.cs new file mode 100644 index 0000000000000..dcd358cd68e36 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SettingNames.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SettingNames.cs new file mode 100644 index 0000000000000..85f6a7b9dd6c3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SettingNames.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SettingNames. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SettingNames + { + [EnumMember(Value = "AutoLogon")] + AutoLogon, + [EnumMember(Value = "FirstLogonCommands")] + FirstLogonCommands + } + internal static class SettingNamesEnumExtension + { + internal static string ToSerializedValue(this SettingNames? value) + { + return value == null ? null : ((SettingNames)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SettingNames value) + { + switch( value ) + { + case SettingNames.AutoLogon: + return "AutoLogon"; + case SettingNames.FirstLogonCommands: + return "FirstLogonCommands"; + } + return null; + } + + internal static SettingNames? ParseSettingNames(this string value) + { + switch( value ) + { + case "AutoLogon": + return SettingNames.AutoLogon; + case "FirstLogonCommands": + return SettingNames.FirstLogonCommands; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ShareInfoElement.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ShareInfoElement.cs new file mode 100644 index 0000000000000..95303e80160e5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ShareInfoElement.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 ShareInfoElement + { + /// + /// Initializes a new instance of the ShareInfoElement class. + /// + public ShareInfoElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ShareInfoElement class. + /// + /// A relative URI containing the ID of the VM that + /// has the disk attached. + public ShareInfoElement(string vmUri = default(string)) + { + VmUri = vmUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a relative URI containing the ID of the VM that has the disk + /// attached. + /// + [JsonProperty(PropertyName = "vmUri")] + public string VmUri { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGallery.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGallery.cs new file mode 100644 index 0000000000000..aef86d0b185c6 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImage.cs new file mode 100644 index 0000000000000..e64cdf38245e3 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImageVersion.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedGalleryImageVersion.cs new file mode 100644 index 0000000000000..b51fcbd0b480e --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedToValues.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharedToValues.cs new file mode 100644 index 0000000000000..463c15183c04c --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfile.cs new file mode 100644 index 0000000000000..772a9e641f95d --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroup.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroup.cs new file mode 100644 index 0000000000000..7a8e4df6262c4 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroupTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingProfileGroupTypes.cs new file mode 100644 index 0000000000000..1f1724bed836d --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdate.cs new file mode 100644 index 0000000000000..a51aa0ad30dc7 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdateOperationTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SharingUpdateOperationTypes.cs new file mode 100644 index 0000000000000..821acf46873ff --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Sku.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Sku.cs new file mode 100644 index 0000000000000..3a3bbc4c45bdc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Sku.cs @@ -0,0 +1,77 @@ +// +// 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 virtual machine scale set sku. NOTE: If the new VM SKU is + /// not supported on the hardware the scale set is currently on, you need + /// to deallocate the VMs in the scale set before you modify the SKU name. + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// The sku name. + /// Specifies the tier of virtual machines in a + /// scale set.<br /><br /> Possible Values:<br + /// /><br /> **Standard**<br /><br /> + /// **Basic** + /// Specifies the number of virtual machines in + /// the scale set. + public Sku(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. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the tier of virtual machines in a scale + /// set.&lt;br /&gt;&lt;br /&gt; Possible + /// Values:&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 virtual machines in the scale + /// set. + /// + [JsonProperty(PropertyName = "capacity")] + public long? Capacity { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs new file mode 100644 index 0000000000000..fdd08f6276e34 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs @@ -0,0 +1,242 @@ +// +// 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; + + /// + /// Snapshot resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class Snapshot : Resource + { + /// + /// Initializes a new instance of the Snapshot class. + /// + public Snapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Snapshot class. + /// + /// Resource location + /// Disk source information. CreationData + /// information cannot be changed after the disk has been + /// created. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Unused. Always Null. + /// The time when the snapshot was + /// created. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// The size of the disk in bytes. This + /// field is read only. + /// The state of the snapshot. Possible values + /// include: 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', + /// 'ReadyToUpload', 'ActiveUpload' + /// Unique Guid identifying the + /// resource. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The disk provisioning + /// state. + /// Whether a snapshot is incremental. + /// Incremental snapshots on the same disk occupy less space than full + /// snapshots and can be diffed. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string diskState = default(string), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool? incremental = default(bool?), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + Sku = sku; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + DiskState = diskState; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + Incremental = incremental; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets unused. Always Null. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public SnapshotSku Sku { get; set; } + + /// + /// Gets the time when the snapshot was created. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { 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 disk source information. CreationData information + /// cannot be changed after the disk has been created. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets the size of the disk in bytes. This field is read only. + /// + [JsonProperty(PropertyName = "properties.diskSizeBytes")] + public long? DiskSizeBytes { get; private set; } + + /// + /// Gets or sets the state of the snapshot. Possible values include: + /// 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', + /// 'ActiveUpload' + /// + [JsonProperty(PropertyName = "properties.diskState")] + public string DiskState { get; set; } + + /// + /// Gets unique Guid identifying the resource. + /// + [JsonProperty(PropertyName = "properties.uniqueId")] + public string UniqueId { get; private set; } + + /// + /// Gets or sets encryption settings collection used be Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets the disk provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets whether a snapshot is incremental. Incremental + /// snapshots on the same disk occupy less space than full snapshots + /// and can be diffed. + /// + [JsonProperty(PropertyName = "properties.incremental")] + public bool? Incremental { get; set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CreationData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreationData"); + } + if (CreationData != null) + { + CreationData.Validate(); + } + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotSku.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotSku.cs new file mode 100644 index 0000000000000..524533ccea18d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotSku.cs @@ -0,0 +1,62 @@ +// +// 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 snapshots sku name. Can be Standard_LRS, Premium_LRS, or + /// Standard_ZRS. + /// + public partial class SnapshotSku + { + /// + /// Initializes a new instance of the SnapshotSku class. + /// + public SnapshotSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SnapshotSku class. + /// + /// The sku name. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'Standard_ZRS' + /// The sku tier. + public SnapshotSku(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 or sets the sku name. Possible values include: 'Standard_LRS', + /// 'Premium_LRS', 'Standard_ZRS' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets the sku tier. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotStorageAccountTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotStorageAccountTypes.cs new file mode 100644 index 0000000000000..966937f790897 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotStorageAccountTypes.cs @@ -0,0 +1,32 @@ +// +// 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 SnapshotStorageAccountTypes. + /// + public static class SnapshotStorageAccountTypes + { + /// + /// Standard HDD locally redundant storage + /// + public const string StandardLRS = "Standard_LRS"; + /// + /// Premium SSD locally redundant storage + /// + public const string PremiumLRS = "Premium_LRS"; + /// + /// Standard zone redundant storage + /// + public const string StandardZRS = "Standard_ZRS"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotUpdate.cs new file mode 100644 index 0000000000000..300c671b7b595 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotUpdate.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Snapshot update resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SnapshotUpdate + { + /// + /// Initializes a new instance of the SnapshotUpdate class. + /// + public SnapshotUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SnapshotUpdate class. + /// + /// the Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Resource tags + public SnapshotUpdate(OperatingSystemTypes? osType = default(OperatingSystemTypes?), int? diskSizeGB = default(int?), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), IDictionary tags = default(IDictionary), SnapshotSku sku = default(SnapshotSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tags = tags; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets encryption settings collection used be Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public SnapshotSku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SourceVault.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SourceVault.cs new file mode 100644 index 0000000000000..3d5219938ba97 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SourceVault.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; + + /// + /// The vault id is an Azure Resource Manager Resource id in the form + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// + public partial class SourceVault + { + /// + /// Initializes a new instance of the SourceVault class. + /// + public SourceVault() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SourceVault class. + /// + /// Resource Id + public SourceVault(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshConfiguration.cs new file mode 100644 index 0000000000000..fb30d37d3d545 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshConfiguration.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; + + /// + /// SSH configuration for Linux based VMs running on Azure + /// + public partial class SshConfiguration + { + /// + /// Initializes a new instance of the SshConfiguration class. + /// + public SshConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshConfiguration class. + /// + /// The list of SSH public keys used to + /// authenticate with linux based VMs. + public SshConfiguration(IList publicKeys = default(IList)) + { + PublicKeys = publicKeys; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of SSH public keys used to authenticate with + /// linux based VMs. + /// + [JsonProperty(PropertyName = "publicKeys")] + public IList PublicKeys { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKey.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKey.cs new file mode 100644 index 0000000000000..c26ca0214e351 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKey.cs @@ -0,0 +1,73 @@ +// +// 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; + + /// + /// Contains information about SSH certificate public key and the path on + /// the Linux VM where the public key is placed. + /// + public partial class SshPublicKey + { + /// + /// Initializes a new instance of the SshPublicKey class. + /// + public SshPublicKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKey class. + /// + /// Specifies the full path on the created VM where + /// ssh public key is stored. If the file already exists, the specified + /// key is appended to the file. Example: + /// /home/user/.ssh/authorized_keys + /// SSH public key certificate used to + /// authenticate with the VM through ssh. The key needs to be at least + /// 2048-bit and in ssh-rsa format. <br><br> For creating + /// ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + public SshPublicKey(string path = default(string), string keyData = default(string)) + { + Path = path; + KeyData = keyData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the full path on the created VM where ssh + /// public key is stored. If the file already exists, the specified key + /// is appended to the file. Example: /home/user/.ssh/authorized_keys + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets SSH public key certificate used to authenticate with + /// the VM through ssh. The key needs to be at least 2048-bit and in + /// ssh-rsa format. &lt;br&gt;&lt;br&gt; For creating + /// ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + /// + [JsonProperty(PropertyName = "keyData")] + public string KeyData { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs new file mode 100644 index 0000000000000..35ef9c46d432e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Response from generation of an SSH key pair. + /// + public partial class SshPublicKeyGenerateKeyPairResult + { + /// + /// Initializes a new instance of the SshPublicKeyGenerateKeyPairResult + /// class. + /// + public SshPublicKeyGenerateKeyPairResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKeyGenerateKeyPairResult + /// class. + /// + /// Private key portion of the key pair used + /// to authenticate to a virtual machine through ssh. The private key + /// is returned in RFC3447 format and should be treated as a + /// secret. + /// Public key portion of the key pair used to + /// authenticate to a virtual machine through ssh. The public key is in + /// ssh-rsa format. + /// The ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName} + public SshPublicKeyGenerateKeyPairResult(string privateKey, string publicKey, string id) + { + PrivateKey = privateKey; + PublicKey = publicKey; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets private key portion of the key pair used to + /// authenticate to a virtual machine through ssh. The private key is + /// returned in RFC3447 format and should be treated as a secret. + /// + [JsonProperty(PropertyName = "privateKey")] + public string PrivateKey { get; set; } + + /// + /// Gets or sets public key portion of the key pair used to + /// authenticate to a virtual machine through ssh. The public key is in + /// ssh-rsa format. + /// + [JsonProperty(PropertyName = "publicKey")] + public string PublicKey { get; set; } + + /// + /// Gets or sets the ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateKey"); + } + if (PublicKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PublicKey"); + } + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyResource.cs new file mode 100644 index 0000000000000..409120e82f04f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyResource.cs @@ -0,0 +1,82 @@ +// +// 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 SSH public key. + /// + [Rest.Serialization.JsonTransformation] + public partial class SshPublicKeyResource : Resource + { + /// + /// Initializes a new instance of the SshPublicKeyResource class. + /// + public SshPublicKeyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKeyResource class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// SSH public key used to authenticate to a + /// virtual machine through ssh. If this property is not initially + /// provided when the resource is created, the publicKey property will + /// be populated when generateKeyPair is called. If the public key is + /// provided upon resource creation, the provided public key needs to + /// be at least 2048-bit and in ssh-rsa format. + public SshPublicKeyResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string publicKey = default(string)) + : base(location, id, name, type, tags) + { + PublicKey = publicKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SSH public key used to authenticate to a virtual + /// machine through ssh. If this property is not initially provided + /// when the resource is created, the publicKey property will be + /// populated when generateKeyPair is called. If the public key is + /// provided upon resource creation, the provided public key needs to + /// be at least 2048-bit and in ssh-rsa format. + /// + [JsonProperty(PropertyName = "properties.publicKey")] + public string PublicKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyUpdateResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyUpdateResource.cs new file mode 100644 index 0000000000000..9a42496ed622c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SshPublicKeyUpdateResource.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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the SSH public key. + /// + [Rest.Serialization.JsonTransformation] + public partial class SshPublicKeyUpdateResource : UpdateResource + { + /// + /// Initializes a new instance of the SshPublicKeyUpdateResource class. + /// + public SshPublicKeyUpdateResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKeyUpdateResource class. + /// + /// Resource tags + /// SSH public key used to authenticate to a + /// virtual machine through ssh. If this property is not initially + /// provided when the resource is created, the publicKey property will + /// be populated when generateKeyPair is called. If the public key is + /// provided upon resource creation, the provided public key needs to + /// be at least 2048-bit and in ssh-rsa format. + public SshPublicKeyUpdateResource(IDictionary tags = default(IDictionary), string publicKey = default(string)) + : base(tags) + { + PublicKey = publicKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SSH public key used to authenticate to a virtual + /// machine through ssh. If this property is not initially provided + /// when the resource is created, the publicKey property will be + /// populated when generateKeyPair is called. If the public key is + /// provided upon resource creation, the provided public key needs to + /// be at least 2048-bit and in ssh-rsa format. + /// + [JsonProperty(PropertyName = "properties.publicKey")] + public string PublicKey { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StatusLevelTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StatusLevelTypes.cs new file mode 100644 index 0000000000000..1ce3be166e640 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StatusLevelTypes.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for StatusLevelTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum StatusLevelTypes + { + [EnumMember(Value = "Info")] + Info, + [EnumMember(Value = "Warning")] + Warning, + [EnumMember(Value = "Error")] + Error + } + internal static class StatusLevelTypesEnumExtension + { + internal static string ToSerializedValue(this StatusLevelTypes? value) + { + return value == null ? null : ((StatusLevelTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this StatusLevelTypes value) + { + switch( value ) + { + case StatusLevelTypes.Info: + return "Info"; + case StatusLevelTypes.Warning: + return "Warning"; + case StatusLevelTypes.Error: + return "Error"; + } + return null; + } + + internal static StatusLevelTypes? ParseStatusLevelTypes(this string value) + { + switch( value ) + { + case "Info": + return StatusLevelTypes.Info; + case "Warning": + return StatusLevelTypes.Warning; + case "Error": + return StatusLevelTypes.Error; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageAccountType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageAccountType.cs new file mode 100644 index 0000000000000..ec564c0010b6e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageAccountType.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 StorageAccountType. + /// + public static class StorageAccountType + { + public const string StandardLRS = "Standard_LRS"; + public const string StandardZRS = "Standard_ZRS"; + public const string PremiumLRS = "Premium_LRS"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageAccountTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageAccountTypes.cs new file mode 100644 index 0000000000000..187a42f0ab6b3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageAccountTypes.cs @@ -0,0 +1,24 @@ +// +// 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 StorageAccountTypes. + /// + public static class StorageAccountTypes + { + public const string StandardLRS = "Standard_LRS"; + public const string PremiumLRS = "Premium_LRS"; + public const string StandardSSDLRS = "StandardSSD_LRS"; + public const string UltraSSDLRS = "UltraSSD_LRS"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageProfile.cs new file mode 100644 index 0000000000000..2bdb4533b7634 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageProfile.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the storage settings for the virtual machine disks. + /// + public partial class StorageProfile + { + /// + /// Initializes a new instance of the StorageProfile class. + /// + public StorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageProfile class. + /// + /// Specifies information about the image + /// to use. You can specify information about platform images, + /// marketplace images, or virtual machine images. This element is + /// required when you want to use a platform image, marketplace image, + /// or virtual machine image, but is not used in other creation + /// operations. + /// Specifies information about the operating + /// system disk used by the virtual machine. <br><br> For + /// more information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// Specifies the parameters that are used to + /// add a data disk to a virtual machine. <br><br> For more + /// information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + public StorageProfile(ImageReference imageReference = default(ImageReference), OSDisk osDisk = default(OSDisk), IList dataDisks = default(IList)) + { + ImageReference = imageReference; + OsDisk = osDisk; + DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies information about the image to use. You can + /// specify information about platform images, marketplace images, or + /// virtual machine images. This element is required when you want to + /// use a platform image, marketplace image, or virtual machine image, + /// but is not used in other creation operations. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets or sets specifies information about the operating system disk + /// used by the virtual machine. &lt;br&gt;&lt;br&gt; + /// For more information about disks, see [About disks and VHDs for + /// Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// + [JsonProperty(PropertyName = "osDisk")] + public OSDisk OsDisk { get; set; } + + /// + /// Gets or sets specifies the parameters that are used to add a data + /// disk to a virtual machine. &lt;br&gt;&lt;br&gt; For + /// more information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsDisk != null) + { + OsDisk.Validate(); + } + if (DataDisks != null) + { + foreach (var element in DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResource.cs new file mode 100644 index 0000000000000..6ca0177652d96 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResource.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 Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class SubResource : IResource + { + /// + /// Initializes a new instance of the SubResource class. + /// + public SubResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubResource class. + /// + /// Resource Id + public SubResource(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResourceReadOnly.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResourceReadOnly.cs new file mode 100644 index 0000000000000..cb9b882cbf515 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResourceReadOnly.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 Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class SubResourceReadOnly : IResource + { + /// + /// Initializes a new instance of the SubResourceReadOnly class. + /// + public SubResourceReadOnly() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubResourceReadOnly class. + /// + /// Resource Id + public SubResourceReadOnly(string id = default(string)) + { + Id = id; + 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; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResourceWithColocationStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResourceWithColocationStatus.cs new file mode 100644 index 0000000000000..a907466198243 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SubResourceWithColocationStatus.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 SubResourceWithColocationStatus : SubResource + { + /// + /// Initializes a new instance of the SubResourceWithColocationStatus + /// class. + /// + public SubResourceWithColocationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubResourceWithColocationStatus + /// class. + /// + /// Resource Id + /// Describes colocation status of a + /// resource in the Proximity Placement Group. + public SubResourceWithColocationStatus(string id = default(string), InstanceViewStatus colocationStatus = default(InstanceViewStatus)) + : base(id) + { + ColocationStatus = colocationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes colocation status of a resource in the + /// Proximity Placement Group. + /// + [JsonProperty(PropertyName = "colocationStatus")] + public InstanceViewStatus ColocationStatus { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/TargetRegion.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/TargetRegion.cs new file mode 100644 index 0000000000000..beb83ddf8a43a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/TargetRegion.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; + + /// + /// Describes the target region information. + /// + public partial class TargetRegion + { + /// + /// Initializes a new instance of the TargetRegion class. + /// + public TargetRegion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetRegion class. + /// + /// The name of the region. + /// The number of replicas of the + /// Image Version to be created per region. 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' + public TargetRegion(string name, int? regionalReplicaCount = default(int?), string storageAccountType = default(string), EncryptionImages encryption = default(EncryptionImages)) + { + Name = name; + RegionalReplicaCount = regionalReplicaCount; + StorageAccountType = storageAccountType; + Encryption = encryption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the region. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the number of replicas of the Image Version to be + /// created per region. This property is updatable. + /// + [JsonProperty(PropertyName = "regionalReplicaCount")] + public int? RegionalReplicaCount { get; set; } + + /// + /// Gets or sets 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' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "encryption")] + public EncryptionImages Encryption { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/TerminateNotificationProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/TerminateNotificationProfile.cs new file mode 100644 index 0000000000000..734e97adc35ad --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/TerminateNotificationProfile.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.Linq; + + public partial class TerminateNotificationProfile + { + /// + /// Initializes a new instance of the TerminateNotificationProfile + /// class. + /// + public TerminateNotificationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TerminateNotificationProfile + /// class. + /// + /// Configurable length of time a + /// Virtual Machine being deleted will have to potentially approve the + /// Terminate Scheduled Event before the event is auto approved (timed + /// out). The configuration must be specified in ISO 8601 format, the + /// default value is 5 minutes (PT5M) + /// Specifies whether the Terminate Scheduled + /// event is enabled or disabled. + public TerminateNotificationProfile(string notBeforeTimeout = default(string), bool? enable = default(bool?)) + { + NotBeforeTimeout = notBeforeTimeout; + Enable = enable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets configurable length of time a Virtual Machine being + /// deleted will have to potentially approve the Terminate Scheduled + /// Event before the event is auto approved (timed out). The + /// configuration must be specified in ISO 8601 format, the default + /// value is 5 minutes (PT5M) + /// + [JsonProperty(PropertyName = "notBeforeTimeout")] + public string NotBeforeTimeout { get; set; } + + /// + /// Gets or sets specifies whether the Terminate Scheduled event is + /// enabled or disabled. + /// + [JsonProperty(PropertyName = "enable")] + public bool? Enable { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ThrottledRequestsInput.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ThrottledRequestsInput.cs new file mode 100644 index 0000000000000..6d74194924122 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ThrottledRequestsInput.cs @@ -0,0 +1,63 @@ +// +// 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; + + /// + /// Api request input for LogAnalytics getThrottledRequests Api. + /// + public partial class ThrottledRequestsInput : LogAnalyticsInputBase + { + /// + /// Initializes a new instance of the ThrottledRequestsInput class. + /// + public ThrottledRequestsInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThrottledRequestsInput class. + /// + /// SAS Uri of the logging blob + /// container to which LogAnalytics Api writes output logs to. + /// From time of the query + /// To time of the query + /// Group query result by Throttle + /// Policy applied. + /// Group query result by Operation + /// 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) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UefiSettings.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UefiSettings.cs new file mode 100644 index 0000000000000..09b95b6c3d096 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UefiSettings.cs @@ -0,0 +1,69 @@ +// +// 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; + + /// + /// Specifies the security settings like secure boot and vTPM used while + /// creating the virtual machine. <br><br>Minimum api-version: + /// 2020-12-01 + /// + public partial class UefiSettings + { + /// + /// Initializes a new instance of the UefiSettings class. + /// + public UefiSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UefiSettings class. + /// + /// Specifies whether secure boot + /// should be enabled on the virtual machine. + /// <br><br>Minimum api-version: 2020-12-01 + /// Specifies whether vTPM should be enabled + /// on the virtual machine. <br><br>Minimum api-version: + /// 2020-12-01 + public UefiSettings(bool? secureBootEnabled = default(bool?), bool? vTpmEnabled = default(bool?)) + { + SecureBootEnabled = secureBootEnabled; + VTpmEnabled = vTpmEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether secure boot should be enabled on the + /// virtual machine. &lt;br&gt;&lt;br&gt;Minimum + /// api-version: 2020-12-01 + /// + [JsonProperty(PropertyName = "secureBootEnabled")] + public bool? SecureBootEnabled { get; set; } + + /// + /// Gets or sets specifies whether vTPM should be enabled on the + /// virtual machine. &lt;br&gt;&lt;br&gt;Minimum + /// api-version: 2020-12-01 + /// + [JsonProperty(PropertyName = "vTpmEnabled")] + public bool? VTpmEnabled { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateResource.cs new file mode 100644 index 0000000000000..36966c4d5b76a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateResource.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; + + /// + /// The Update Resource model definition. + /// + public partial class UpdateResource + { + /// + /// Initializes a new instance of the UpdateResource class. + /// + public UpdateResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateResource class. + /// + /// Resource tags + public UpdateResource(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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateResourceDefinition.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateResourceDefinition.cs new file mode 100644 index 0000000000000..d6e03b654c5f8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpdateResourceDefinition.cs @@ -0,0 +1,79 @@ +// +// 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; + + /// + /// The Update Resource model definition. + /// + public partial class UpdateResourceDefinition : IResource + { + /// + /// Initializes a new instance of the UpdateResourceDefinition class. + /// + public UpdateResourceDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateResourceDefinition class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + public UpdateResourceDefinition(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + 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 tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeMode.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeMode.cs new file mode 100644 index 0000000000000..b68f7260974e3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeMode.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UpgradeMode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UpgradeMode + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "Manual")] + Manual, + [EnumMember(Value = "Rolling")] + Rolling + } + internal static class UpgradeModeEnumExtension + { + internal static string ToSerializedValue(this UpgradeMode? value) + { + return value == null ? null : ((UpgradeMode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UpgradeMode value) + { + switch( value ) + { + case UpgradeMode.Automatic: + return "Automatic"; + case UpgradeMode.Manual: + return "Manual"; + case UpgradeMode.Rolling: + return "Rolling"; + } + return null; + } + + internal static UpgradeMode? ParseUpgradeMode(this string value) + { + switch( value ) + { + case "Automatic": + return UpgradeMode.Automatic; + case "Manual": + return UpgradeMode.Manual; + case "Rolling": + return UpgradeMode.Rolling; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs new file mode 100644 index 0000000000000..4abc3b68b679b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Virtual Machine Scale Set OS Upgrade History operation response. + /// + public partial class UpgradeOperationHistoricalStatusInfo + { + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfo class. + /// + public UpgradeOperationHistoricalStatusInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfo class. + /// + /// Information about the properties of the + /// upgrade operation. + /// Resource type + /// Resource location + public UpgradeOperationHistoricalStatusInfo(UpgradeOperationHistoricalStatusInfoProperties properties = default(UpgradeOperationHistoricalStatusInfoProperties), string type = default(string), string location = default(string)) + { + Properties = properties; + Type = type; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets information about the properties of the upgrade operation. + /// + [JsonProperty(PropertyName = "properties")] + public UpgradeOperationHistoricalStatusInfoProperties Properties { 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; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs new file mode 100644 index 0000000000000..9223ff4f85cb4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs @@ -0,0 +1,98 @@ +// +// 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 each OS upgrade on the Virtual Machine Scale Set. + /// + public partial class UpgradeOperationHistoricalStatusInfoProperties + { + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfoProperties class. + /// + public UpgradeOperationHistoricalStatusInfoProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfoProperties class. + /// + /// Information about the overall status of + /// the upgrade operation. + /// Counts of the VMs in each state. + /// Error Details for this upgrade if there are + /// any. + /// Invoker of the Upgrade Operation. Possible + /// values include: 'Unknown', 'User', 'Platform' + /// Image Reference details + /// Information about OS rollback if + /// performed + public UpgradeOperationHistoricalStatusInfoProperties(UpgradeOperationHistoryStatus runningStatus = default(UpgradeOperationHistoryStatus), RollingUpgradeProgressInfo progress = default(RollingUpgradeProgressInfo), ApiError error = default(ApiError), UpgradeOperationInvoker? startedBy = default(UpgradeOperationInvoker?), ImageReference targetImageReference = default(ImageReference), RollbackStatusInfo rollbackInfo = default(RollbackStatusInfo)) + { + RunningStatus = runningStatus; + Progress = progress; + Error = error; + StartedBy = startedBy; + TargetImageReference = targetImageReference; + RollbackInfo = rollbackInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets information about the overall status of the upgrade operation. + /// + [JsonProperty(PropertyName = "runningStatus")] + public UpgradeOperationHistoryStatus RunningStatus { get; private set; } + + /// + /// Gets counts of the VMs in each state. + /// + [JsonProperty(PropertyName = "progress")] + public RollingUpgradeProgressInfo Progress { get; private set; } + + /// + /// Gets error Details for this upgrade if there are any. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + /// + /// Gets invoker of the Upgrade Operation. Possible values include: + /// 'Unknown', 'User', 'Platform' + /// + [JsonProperty(PropertyName = "startedBy")] + public UpgradeOperationInvoker? StartedBy { get; private set; } + + /// + /// Gets image Reference details + /// + [JsonProperty(PropertyName = "targetImageReference")] + public ImageReference TargetImageReference { get; private set; } + + /// + /// Gets information about OS rollback if performed + /// + [JsonProperty(PropertyName = "rollbackInfo")] + public RollbackStatusInfo RollbackInfo { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.cs new file mode 100644 index 0000000000000..2cf34e000ae40 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.cs @@ -0,0 +1,73 @@ +// +// 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; + + /// + /// Information about the current running state of the overall upgrade. + /// + public partial class UpgradeOperationHistoryStatus + { + /// + /// Initializes a new instance of the UpgradeOperationHistoryStatus + /// class. + /// + public UpgradeOperationHistoryStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpgradeOperationHistoryStatus + /// class. + /// + /// Code indicating the current status of the + /// upgrade. Possible values include: 'RollingForward', 'Cancelled', + /// 'Completed', 'Faulted' + /// Start time of the upgrade. + /// End time of the upgrade. + public UpgradeOperationHistoryStatus(UpgradeState? code = default(UpgradeState?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?)) + { + Code = code; + StartTime = startTime; + EndTime = endTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets code indicating the current status of the upgrade. Possible + /// values include: 'RollingForward', 'Cancelled', 'Completed', + /// 'Faulted' + /// + [JsonProperty(PropertyName = "code")] + public UpgradeState? Code { get; private set; } + + /// + /// Gets start time of the upgrade. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets end time of the upgrade. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationInvoker.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationInvoker.cs new file mode 100644 index 0000000000000..50decd99c59f0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeOperationInvoker.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UpgradeOperationInvoker. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UpgradeOperationInvoker + { + [EnumMember(Value = "Unknown")] + Unknown, + [EnumMember(Value = "User")] + User, + [EnumMember(Value = "Platform")] + Platform + } + internal static class UpgradeOperationInvokerEnumExtension + { + internal static string ToSerializedValue(this UpgradeOperationInvoker? value) + { + return value == null ? null : ((UpgradeOperationInvoker)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UpgradeOperationInvoker value) + { + switch( value ) + { + case UpgradeOperationInvoker.Unknown: + return "Unknown"; + case UpgradeOperationInvoker.User: + return "User"; + case UpgradeOperationInvoker.Platform: + return "Platform"; + } + return null; + } + + internal static UpgradeOperationInvoker? ParseUpgradeOperationInvoker(this string value) + { + switch( value ) + { + case "Unknown": + return UpgradeOperationInvoker.Unknown; + case "User": + return UpgradeOperationInvoker.User; + case "Platform": + return UpgradeOperationInvoker.Platform; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradePolicy.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradePolicy.cs new file mode 100644 index 0000000000000..03e3f9eb49396 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradePolicy.cs @@ -0,0 +1,98 @@ +// +// 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 an upgrade policy - automatic, manual, or rolling. + /// + public partial class UpgradePolicy + { + /// + /// Initializes a new instance of the UpgradePolicy class. + /// + public UpgradePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpgradePolicy class. + /// + /// Specifies the mode of an upgrade to virtual + /// machines in the scale set.<br /><br /> Possible values + /// are:<br /><br /> **Manual** - You control the + /// application of updates to virtual machines in the scale set. You do + /// this by using the manualUpgrade action.<br /><br /> + /// **Automatic** - All virtual machines in the scale set are + /// automatically updated at the same time. Possible values include: + /// 'Automatic', 'Manual', 'Rolling' + /// The configuration parameters + /// used while performing a rolling upgrade. + /// Configuration parameters + /// used for performing automatic OS Upgrade. + public UpgradePolicy(UpgradeMode? mode = default(UpgradeMode?), RollingUpgradePolicy rollingUpgradePolicy = default(RollingUpgradePolicy), AutomaticOSUpgradePolicy automaticOSUpgradePolicy = default(AutomaticOSUpgradePolicy)) + { + Mode = mode; + RollingUpgradePolicy = rollingUpgradePolicy; + AutomaticOSUpgradePolicy = automaticOSUpgradePolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mode of an upgrade to virtual machines + /// in the scale set.&lt;br /&gt;&lt;br /&gt; Possible + /// values are:&lt;br /&gt;&lt;br /&gt; **Manual** - + /// You control the application of updates to virtual machines in the + /// scale set. You do this by using the manualUpgrade action.&lt;br + /// /&gt;&lt;br /&gt; **Automatic** - All virtual machines + /// in the scale set are automatically updated at the same time. + /// Possible values include: 'Automatic', 'Manual', 'Rolling' + /// + [JsonProperty(PropertyName = "mode")] + public UpgradeMode? Mode { get; set; } + + /// + /// Gets or sets the configuration parameters used while performing a + /// rolling upgrade. + /// + [JsonProperty(PropertyName = "rollingUpgradePolicy")] + public RollingUpgradePolicy RollingUpgradePolicy { get; set; } + + /// + /// Gets or sets configuration parameters used for performing automatic + /// OS Upgrade. + /// + [JsonProperty(PropertyName = "automaticOSUpgradePolicy")] + public AutomaticOSUpgradePolicy AutomaticOSUpgradePolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RollingUpgradePolicy != null) + { + RollingUpgradePolicy.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeState.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeState.cs new file mode 100644 index 0000000000000..24d3093b3803c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UpgradeState.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UpgradeState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UpgradeState + { + [EnumMember(Value = "RollingForward")] + RollingForward, + [EnumMember(Value = "Cancelled")] + Cancelled, + [EnumMember(Value = "Completed")] + Completed, + [EnumMember(Value = "Faulted")] + Faulted + } + internal static class UpgradeStateEnumExtension + { + internal static string ToSerializedValue(this UpgradeState? value) + { + return value == null ? null : ((UpgradeState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UpgradeState value) + { + switch( value ) + { + case UpgradeState.RollingForward: + return "RollingForward"; + case UpgradeState.Cancelled: + return "Cancelled"; + case UpgradeState.Completed: + return "Completed"; + case UpgradeState.Faulted: + return "Faulted"; + } + return null; + } + + internal static UpgradeState? ParseUpgradeState(this string value) + { + switch( value ) + { + case "RollingForward": + return UpgradeState.RollingForward; + case "Cancelled": + return UpgradeState.Cancelled; + case "Completed": + return UpgradeState.Completed; + case "Faulted": + return UpgradeState.Faulted; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Usage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Usage.cs new file mode 100644 index 0000000000000..20ec92fe5c680 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Usage.cs @@ -0,0 +1,96 @@ +// +// 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; + + /// + /// Describes Compute Resource Usage. + /// + public partial class Usage + { + /// + /// Initializes a new instance of the Usage class. + /// + public Usage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Usage class. + /// + /// The current usage of the + /// resource. + /// The maximum permitted usage of the + /// resource. + /// The name of the type of usage. + public Usage(int currentValue, long limit, UsageName name) + { + CurrentValue = currentValue; + Limit = limit; + Name = name; + CustomInit(); + } + /// + /// Static constructor for Usage class. + /// + static Usage() + { + Unit = "Count"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current usage of the resource. + /// + [JsonProperty(PropertyName = "currentValue")] + public int CurrentValue { get; set; } + + /// + /// Gets or sets the maximum permitted usage of the resource. + /// + [JsonProperty(PropertyName = "limit")] + public long Limit { get; set; } + + /// + /// Gets or sets the name of the type of usage. + /// + [JsonProperty(PropertyName = "name")] + public UsageName Name { get; set; } + + /// + /// An enum describing the unit of usage measurement. + /// + [JsonProperty(PropertyName = "unit")] + public static string Unit { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UsageName.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UsageName.cs new file mode 100644 index 0000000000000..f7cd7d3ae483a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UsageName.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Usage Names. + /// + public partial class UsageName + { + /// + /// Initializes a new instance of the UsageName class. + /// + public UsageName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsageName class. + /// + /// The name of the resource. + /// The localized name of the + /// resource. + public UsageName(string value = default(string), string localizedValue = default(string)) + { + Value = value; + LocalizedValue = localizedValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the resource. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets the localized name of the resource. + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactSource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactSource.cs new file mode 100644 index 0000000000000..a37d1ec81227a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UserArtifactSource.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source image from which the Image Version is going to be created. + /// + public partial class UserArtifactSource + { + /// + /// Initializes a new instance of the UserArtifactSource class. + /// + public UserArtifactSource() + { + CustomInit(); + } + + /// + /// 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) + { + FileName = fileName; + MediaLink = mediaLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + 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. + /// + [JsonProperty(PropertyName = "mediaLink")] + public string MediaLink { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + 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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGalleryApplication.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGalleryApplication.cs new file mode 100644 index 0000000000000..92f61431fa60e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGalleryApplication.cs @@ -0,0 +1,116 @@ +// +// 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; + + /// + /// Specifies the required information to reference a compute gallery + /// application version + /// + public partial class VMGalleryApplication + { + /// + /// Initializes a new instance of the VMGalleryApplication class. + /// + public VMGalleryApplication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMGalleryApplication class. + /// + /// Specifies the + /// GalleryApplicationVersion reference in URL form. e.g. + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + /// Optional, Specifies a passthrough value for more + /// generic context. + /// Optional, Specifies the order in which the + /// packages have to be installed, has no effect if manuallyManaged is + /// set to true + /// Specifies whether the gallery + /// application would be manually managed. If set to true, the + /// VMApplicationExtension would not manage the gallery + /// application + /// Optional, Specifies the uri to + /// an azure blob that will replace the default configuration for the + /// package if provided + public VMGalleryApplication(string packageReferenceId, string tags = default(string), int? order = default(int?), bool? manuallyManaged = default(bool?), string configurationReference = default(string)) + { + Tags = tags; + Order = order; + ManuallyManaged = manuallyManaged; + PackageReferenceId = packageReferenceId; + ConfigurationReference = configurationReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets optional, Specifies a passthrough value for more + /// generic context. + /// + [JsonProperty(PropertyName = "tags")] + public string Tags { get; set; } + + /// + /// Gets or sets optional, Specifies the order in which the packages + /// have to be installed, has no effect if manuallyManaged is set to + /// true + /// + [JsonProperty(PropertyName = "order")] + public int? Order { get; set; } + + /// + /// Gets or sets specifies whether the gallery application would be + /// manually managed. If set to true, the VMApplicationExtension would + /// not manage the gallery application + /// + [JsonProperty(PropertyName = "manuallyManaged")] + public bool? ManuallyManaged { get; set; } + + /// + /// Gets or sets specifies the GalleryApplicationVersion reference in + /// URL form. e.g. + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + /// + [JsonProperty(PropertyName = "packageReferenceId")] + public string PackageReferenceId { get; set; } + + /// + /// Gets or sets optional, Specifies the uri to an azure blob that will + /// replace the default configuration for the package if provided + /// + [JsonProperty(PropertyName = "configurationReference")] + public string ConfigurationReference { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PackageReferenceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PackageReferenceId"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationLinux.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationLinux.cs new file mode 100644 index 0000000000000..0cc53c8e44fca --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationLinux.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 VMGuestPatchClassificationLinux. + /// + public static class VMGuestPatchClassificationLinux + { + public const string Critical = "Critical"; + public const string Security = "Security"; + public const string Other = "Other"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationWindows.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationWindows.cs new file mode 100644 index 0000000000000..e98f65e64153f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationWindows.cs @@ -0,0 +1,28 @@ +// +// 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 VMGuestPatchClassificationWindows. + /// + public static class VMGuestPatchClassificationWindows + { + public const string Critical = "Critical"; + public const string Security = "Security"; + public const string UpdateRollUp = "UpdateRollUp"; + public const string FeaturePack = "FeaturePack"; + public const string ServicePack = "ServicePack"; + public const string Definition = "Definition"; + public const string Tools = "Tools"; + public const string Updates = "Updates"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SoftwareUpdateRebootBehavior.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootBehavior.cs similarity index 80% rename from sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SoftwareUpdateRebootBehavior.cs rename to compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootBehavior.cs index de78bf037aca7..87a76dded6d92 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SoftwareUpdateRebootBehavior.cs +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootBehavior.cs @@ -12,10 +12,11 @@ namespace Microsoft.Azure.Management.Compute.Models { /// - /// Defines values for SoftwareUpdateRebootBehavior. + /// Defines values for VMGuestPatchRebootBehavior. /// - public static class SoftwareUpdateRebootBehavior + public static class VMGuestPatchRebootBehavior { + public const string Unknown = "Unknown"; public const string NeverReboots = "NeverReboots"; public const string AlwaysRequiresReboot = "AlwaysRequiresReboot"; public const string CanRequestReboot = "CanRequestReboot"; diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootSetting.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootSetting.cs new file mode 100644 index 0000000000000..ebfef92400a41 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootSetting.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 VMGuestPatchRebootSetting. + /// + public static class VMGuestPatchRebootSetting + { + public const string IfRequired = "IfRequired"; + public const string Never = "Never"; + public const string Always = "Always"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RebootStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootStatus.cs similarity index 82% rename from sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RebootStatus.cs rename to compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootStatus.cs index b04c6371134e3..f9bf1a04138e6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RebootStatus.cs +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootStatus.cs @@ -12,10 +12,11 @@ namespace Microsoft.Azure.Management.Compute.Models { /// - /// Defines values for RebootStatus. + /// Defines values for VMGuestPatchRebootStatus. /// - public static class RebootStatus + public static class VMGuestPatchRebootStatus { + public const string Unknown = "Unknown"; public const string NotNeeded = "NotNeeded"; public const string Required = "Required"; public const string Started = "Started"; diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMScaleSetConvertToSinglePlacementGroupInput.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMScaleSetConvertToSinglePlacementGroupInput.cs new file mode 100644 index 0000000000000..b2955a8cb32da --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMScaleSetConvertToSinglePlacementGroupInput.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 Newtonsoft.Json; + using System.Linq; + + public partial class VMScaleSetConvertToSinglePlacementGroupInput + { + /// + /// Initializes a new instance of the + /// VMScaleSetConvertToSinglePlacementGroupInput class. + /// + public VMScaleSetConvertToSinglePlacementGroupInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VMScaleSetConvertToSinglePlacementGroupInput class. + /// + /// Id of the placement group in + /// which you want future virtual machine instances to be placed. To + /// query placement group Id, please use Virtual Machine Scale Set VMs + /// - Get API. If not provided, the platform will choose one with + /// maximum number of virtual machine instances. + public VMScaleSetConvertToSinglePlacementGroupInput(string activePlacementGroupId = default(string)) + { + ActivePlacementGroupId = activePlacementGroupId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the placement group in which you want future + /// virtual machine instances to be placed. To query placement group + /// Id, please use Virtual Machine Scale Set VMs - Get API. If not + /// provided, the platform will choose one with maximum number of + /// virtual machine instances. + /// + [JsonProperty(PropertyName = "activePlacementGroupId")] + public string ActivePlacementGroupId { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VaultCertificate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VaultCertificate.cs new file mode 100644 index 0000000000000..287aa0c56b4cf --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VaultCertificate.cs @@ -0,0 +1,93 @@ +// +// 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 VM. + /// + public partial class VaultCertificate + { + /// + /// Initializes a new instance of the VaultCertificate class. + /// + public VaultCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultCertificate class. + /// + /// This is the URL of a certificate that + /// has been uploaded to Key Vault as a secret. For adding a secret to + /// the Key Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// <br><br> {<br> + /// "data":"<Base64-encoded-certificate>",<br> + /// "dataType":"pfx",<br> + /// "password":"<pfx-file-password>"<br>} + /// For Windows VMs, specifies the + /// certificate store on the Virtual Machine to which the certificate + /// should be added. The specified certificate store is implicitly in + /// the LocalMachine account. <br><br>For Linux VMs, the + /// certificate file is placed under the /var/lib/waagent directory, + /// with the file name &lt;UppercaseThumbprint&gt;.crt for the + /// X509 certificate file and &lt;UppercaseThumbprint&gt;.prv + /// for private key. Both of these files are .pem formatted. + public VaultCertificate(string certificateUrl = default(string), string certificateStore = default(string)) + { + CertificateUrl = certificateUrl; + CertificateStore = certificateStore; + 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. For adding a secret to the Key + /// Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// &lt;br&gt;&lt;br&gt; {&lt;br&gt; + /// "data":"&lt;Base64-encoded-certificate&gt;",&lt;br&gt; + /// "dataType":"pfx",&lt;br&gt; + /// "password":"&lt;pfx-file-password&gt;"&lt;br&gt;} + /// + [JsonProperty(PropertyName = "certificateUrl")] + public string CertificateUrl { get; set; } + + /// + /// Gets or sets for Windows VMs, specifies the certificate store on + /// the Virtual Machine to which the certificate should be added. The + /// specified certificate store is implicitly in the LocalMachine + /// account. &lt;br&gt;&lt;br&gt;For Linux VMs, the + /// certificate file is placed under the /var/lib/waagent directory, + /// with the file name &amp;lt;UppercaseThumbprint&amp;gt;.crt + /// for the X509 certificate file and + /// &amp;lt;UppercaseThumbprint&amp;gt;.prv for private key. + /// Both of these files are .pem formatted. + /// + [JsonProperty(PropertyName = "certificateStore")] + public string CertificateStore { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VaultSecretGroup.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VaultSecretGroup.cs new file mode 100644 index 0000000000000..059934972a213 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VaultSecretGroup.cs @@ -0,0 +1,65 @@ +// +// 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 VaultSecretGroup + { + /// + /// Initializes a new instance of the VaultSecretGroup class. + /// + public VaultSecretGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultSecretGroup 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 VaultSecretGroup(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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualHardDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualHardDisk.cs new file mode 100644 index 0000000000000..5434e0ff26be3 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualHardDisk.cs @@ -0,0 +1,51 @@ +// +// 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 uri of a disk. + /// + public partial class VirtualHardDisk + { + /// + /// Initializes a new instance of the VirtualHardDisk class. + /// + public VirtualHardDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualHardDisk class. + /// + /// Specifies the virtual hard disk's uri. + public VirtualHardDisk(string uri = default(string)) + { + Uri = uri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the virtual hard disk's uri. + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachine.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachine.cs new file mode 100644 index 0000000000000..712142f6324b9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachine.cs @@ -0,0 +1,483 @@ +// +// 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; + + /// + /// Describes a Virtual Machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachine : Resource + { + /// + /// Initializes a new instance of the VirtualMachine class. + /// + public VirtualMachine() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachine class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Specifies information about the marketplace + /// image used to create the virtual machine. This element is only used + /// for marketplace images. Before you can use a marketplace image from + /// an API, you must enable the image for programmatic use. In the + /// Azure portal, find the marketplace image that you want to use and + /// then click **Want to deploy programmatically, Get Started ->**. + /// Enter any required information and then click **Save**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// Specifies information about the + /// availability set that the virtual machine should be assigned to. + /// Virtual machines specified in the same availability set are + /// allocated to different nodes to maximize availability. For more + /// information about availability sets, see [Manage the availability + /// of virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// <br><br> For more information on Azure planned + /// maintenance, see [Planned maintenance for virtual machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. The availability set to which + /// the VM is being added should be under the same resource group as + /// the availability set resource. An existing VM cannot be added to an + /// availability set. <br><br>This property cannot exist + /// along with a non-null properties.virtualMachineScaleSet + /// reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. <br><br>This property cannot + /// exist along with a non-null properties.availabilitySet reference. + /// <br><br>Minimum api‐version: 2019‐03‐01 + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains.<br><li>This is applicable only if the + /// 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.<li>The Virtual Machine Scale Set that is referenced, + /// must have 'platformFaultDomainCount' &gt; 1.<li>This + /// property cannot be updated once the Virtual Machine is + /// created.<li>Fault domain assignment can be viewed in the + /// Virtual Machine Instance View.<br><br>Minimum + /// api‐version: 2020‐12‐01 + /// Specifies the priority for the virtual + /// machine. <br><br>Minimum api-version: 2019-03-01. + /// Possible values include: 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. + /// <br><br>For Azure Spot virtual machines, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2019-03-01. <br><br>For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. <br><br>Minimum + /// api-version: 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. <br><br>Minimum + /// api-version: 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// <br><br>NOTE: User cannot specify both host and + /// hostGroup properties. + /// The provisioning state, which only + /// appears in the response. + /// 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) + /// <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 + /// and can be read using platform BIOS commands. + /// Specifies the time alloted for + /// all extensions to start. The time duration should be between 15 + /// minutes and 120 minutes (inclusive) and should be specified in ISO + /// 8601 format. The default value is 90 minutes (PT1H30M). + /// <br><br> Minimum api-version: 2020-06-01 + /// The virtual machine child extension + /// resources. + /// The identity of the virtual machine, if + /// configured. + /// The virtual machine zones. + /// The extended location of the Virtual + /// Machine. + public VirtualMachine(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), int? platformFaultDomain = default(int?), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), IList resources = default(IList), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + ApplicationProfile = applicationProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + PlatformFaultDomain = platformFaultDomain; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + Resources = resources; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies information about the marketplace image used + /// to create the virtual machine. This element is only used for + /// marketplace images. Before you can use a marketplace image from an + /// API, you must enable the image for programmatic use. In the Azure + /// portal, find the marketplace image that you want to use and then + /// click **Want to deploy programmatically, Get Started -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets specifies the hardware settings for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.hardwareProfile")] + public HardwareProfile HardwareProfile { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the operating system settings used while + /// creating the virtual machine. Some of the settings cannot be + /// changed once VM is provisioned. + /// + [JsonProperty(PropertyName = "properties.osProfile")] + public OSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the network interfaces of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machine. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2015-06-15. + /// + [JsonProperty(PropertyName = "properties.diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets specifies information about the availability set that + /// the virtual machine should be assigned to. Virtual machines + /// specified in the same availability set are allocated to different + /// nodes to maximize availability. For more information about + /// availability sets, see [Manage the availability of virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// &lt;br&gt;&lt;br&gt; For more information on Azure + /// planned maintenance, see [Planned maintenance for virtual machines + /// in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; Currently, a VM can only be + /// added to availability set at creation time. The availability set to + /// which the VM is being added should be under the same resource group + /// as the availability set resource. An existing VM cannot be added to + /// an availability set. &lt;br&gt;&lt;br&gt;This + /// property cannot exist along with a non-null + /// properties.virtualMachineScaleSet reference. + /// + [JsonProperty(PropertyName = "properties.availabilitySet")] + public SubResource AvailabilitySet { get; set; } + + /// + /// Gets or sets specifies information about the virtual machine scale + /// set that the virtual machine should be assigned to. Virtual + /// machines specified in the same virtual machine scale set are + /// allocated to different nodes to maximize availability. Currently, a + /// VM can only be added to virtual machine scale set at creation time. + /// An existing VM cannot be added to a virtual machine scale set. + /// &lt;br&gt;&lt;br&gt;This property cannot exist + /// along with a non-null properties.availabilitySet reference. + /// &lt;br&gt;&lt;br&gt;Minimum api‐version: 2019‐03‐01 + /// + [JsonProperty(PropertyName = "properties.virtualMachineScaleSet")] + public SubResource VirtualMachineScaleSet { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine should be assigned to. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets specifies the scale set logical fault domain into + /// which the Virtual Machine will be created. By default, the Virtual + /// Machine will by automatically assigned to a fault domain that best + /// maintains balance across available fault + /// domains.&lt;br&gt;&lt;li&gt;This is applicable only + /// if the 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.&lt;li&gt;The Virtual Machine Scale Set that is + /// referenced, must have 'platformFaultDomainCount' &amp;gt; + /// 1.&lt;li&gt;This property cannot be updated once the + /// Virtual Machine is created.&lt;li&gt;Fault domain + /// assignment can be viewed in the Virtual Machine Instance + /// View.&lt;br&gt;&lt;br&gt;Minimum api‐version: + /// 2020‐12‐01 + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies the priority for the virtual machine. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2019-03-01. Possible values include: 'Regular', 'Low', 'Spot' + /// + [JsonProperty(PropertyName = "properties.priority")] + public string Priority { get; set; } + + /// + /// Gets or sets specifies the eviction policy for the Azure Spot + /// virtual machine and Azure Spot scale set. + /// &lt;br&gt;&lt;br&gt;For Azure Spot virtual + /// machines, both 'Deallocate' and 'Delete' are supported and the + /// minimum api-version is 2019-03-01. + /// &lt;br&gt;&lt;br&gt;For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// + [JsonProperty(PropertyName = "properties.evictionPolicy")] + public string EvictionPolicy { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// virtual machine. &lt;br&gt;&lt;br&gt;Minimum + /// api-version: 2019-03-01. + /// + [JsonProperty(PropertyName = "properties.billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host that + /// the virtual machine resides in. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-10-01. + /// + [JsonProperty(PropertyName = "properties.host")] + public SubResource Host { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host group + /// that the virtual machine resides in. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2020-06-01. &lt;br&gt;&lt;br&gt;NOTE: User cannot + /// specify both host and hostGroup properties. + /// + [JsonProperty(PropertyName = "properties.hostGroup")] + public SubResource HostGroup { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the virtual machine instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineInstanceView InstanceView { get; private set; } + + /// + /// 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: + /// &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; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets specifies the VM unique ID which is a 128-bits identifier that + /// is encoded and stored in all Azure IaaS VMs SMBIOS and can be read + /// using platform BIOS commands. + /// + [JsonProperty(PropertyName = "properties.vmId")] + public string VmId { get; private set; } + + /// + /// Gets or sets specifies the time alloted for all extensions to + /// start. The time duration should be between 15 minutes and 120 + /// minutes (inclusive) and should be specified in ISO 8601 format. The + /// default value is 90 minutes (PT1H30M). + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2020-06-01 + /// + [JsonProperty(PropertyName = "properties.extensionsTimeBudget")] + public string ExtensionsTimeBudget { get; set; } + + /// + /// Gets the virtual machine child extension resources. + /// + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; private set; } + + /// + /// Gets or sets the identity of the virtual machine, if configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineIdentity Identity { get; set; } + + /// + /// Gets or sets the virtual machine zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets or sets the extended location of the Virtual Machine. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + if (Resources != null) + { + foreach (var element in Resources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.cs new file mode 100644 index 0000000000000..2399739f2cfdc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.cs @@ -0,0 +1,72 @@ +// +// 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 VM Agent running on the virtual machine. + /// + public partial class VirtualMachineAgentInstanceView + { + /// + /// Initializes a new instance of the VirtualMachineAgentInstanceView + /// class. + /// + public VirtualMachineAgentInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineAgentInstanceView + /// class. + /// + /// The VM Agent full version. + /// The virtual machine extension + /// handler instance view. + /// The resource status information. + public VirtualMachineAgentInstanceView(string vmAgentVersion = default(string), IList extensionHandlers = default(IList), IList statuses = default(IList)) + { + VmAgentVersion = vmAgentVersion; + ExtensionHandlers = extensionHandlers; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the VM Agent full version. + /// + [JsonProperty(PropertyName = "vmAgentVersion")] + public string VmAgentVersion { get; set; } + + /// + /// Gets or sets the virtual machine extension handler instance view. + /// + [JsonProperty(PropertyName = "extensionHandlers")] + public IList ExtensionHandlers { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs new file mode 100644 index 0000000000000..9bb2a7c3e50cf --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs @@ -0,0 +1,138 @@ +// +// 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 properties of an AssessPatches result. + /// + public partial class VirtualMachineAssessPatchesResult + { + /// + /// Initializes a new instance of the VirtualMachineAssessPatchesResult + /// class. + /// + public VirtualMachineAssessPatchesResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineAssessPatchesResult + /// class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the operation + /// that produced this result. It is used to correlate across CRP and + /// extension logs. + /// The overall reboot status of the VM. It + /// will be true when partially installed patches require a reboot to + /// complete installation but the reboot has not yet occurred. + /// The number of critical + /// or security patches that have been detected as available and not + /// yet installed. + /// The number of all available patches + /// excluding critical and security. + /// The UTC timestamp when the operation + /// began. + /// The list of patches that have been + /// detected as available for installation. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public VirtualMachineAssessPatchesResult(string status = default(string), string assessmentActivityId = default(string), bool? rebootPending = default(bool?), int? criticalAndSecurityPatchCount = default(int?), int? otherPatchCount = default(int?), System.DateTime? startDateTime = default(System.DateTime?), IList availablePatches = default(IList), ApiError error = default(ApiError)) + { + Status = status; + AssessmentActivityId = assessmentActivityId; + RebootPending = rebootPending; + CriticalAndSecurityPatchCount = criticalAndSecurityPatchCount; + OtherPatchCount = otherPatchCount; + StartDateTime = startDateTime; + AvailablePatches = availablePatches; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "assessmentActivityId")] + public string AssessmentActivityId { get; private set; } + + /// + /// Gets the overall reboot status of the VM. It will be true when + /// partially installed patches require a reboot to complete + /// installation but the reboot has not yet occurred. + /// + [JsonProperty(PropertyName = "rebootPending")] + public bool? RebootPending { get; private set; } + + /// + /// Gets the number of critical or security patches that have been + /// detected as available and not yet installed. + /// + [JsonProperty(PropertyName = "criticalAndSecurityPatchCount")] + public int? CriticalAndSecurityPatchCount { get; private set; } + + /// + /// Gets the number of all available patches excluding critical and + /// security. + /// + [JsonProperty(PropertyName = "otherPatchCount")] + public int? OtherPatchCount { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime { get; private set; } + + /// + /// Gets the list of patches that have been detected as available for + /// installation. + /// + [JsonProperty(PropertyName = "availablePatches")] + public IList AvailablePatches { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineCaptureParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineCaptureParameters.cs new file mode 100644 index 0000000000000..4abdc0fbe1dd9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineCaptureParameters.cs @@ -0,0 +1,91 @@ +// +// 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; + + /// + /// Capture Virtual Machine parameters. + /// + public partial class VirtualMachineCaptureParameters + { + /// + /// Initializes a new instance of the VirtualMachineCaptureParameters + /// class. + /// + public VirtualMachineCaptureParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineCaptureParameters + /// class. + /// + /// The captured virtual hard disk's name + /// prefix. + /// The destination container + /// name. + /// Specifies whether to overwrite the + /// destination virtual hard disk, in case of conflict. + public VirtualMachineCaptureParameters(string vhdPrefix, string destinationContainerName, bool overwriteVhds) + { + VhdPrefix = vhdPrefix; + DestinationContainerName = destinationContainerName; + OverwriteVhds = overwriteVhds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the captured virtual hard disk's name prefix. + /// + [JsonProperty(PropertyName = "vhdPrefix")] + public string VhdPrefix { get; set; } + + /// + /// Gets or sets the destination container name. + /// + [JsonProperty(PropertyName = "destinationContainerName")] + public string DestinationContainerName { get; set; } + + /// + /// Gets or sets specifies whether to overwrite the destination virtual + /// hard disk, in case of conflict. + /// + [JsonProperty(PropertyName = "overwriteVhds")] + public bool OverwriteVhds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VhdPrefix == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VhdPrefix"); + } + if (DestinationContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DestinationContainerName"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs new file mode 100644 index 0000000000000..95398bbdf8ad5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs @@ -0,0 +1,84 @@ +// +// 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; + + /// + /// Output of virtual machine capture operation. + /// + public partial class VirtualMachineCaptureResult : SubResource + { + /// + /// Initializes a new instance of the VirtualMachineCaptureResult + /// class. + /// + public VirtualMachineCaptureResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineCaptureResult + /// class. + /// + /// Resource Id + /// the schema of the captured virtual + /// machine + /// the version of the content + /// parameters of the captured virtual + /// machine + /// a list of resource items of the captured + /// virtual machine + public VirtualMachineCaptureResult(string id = default(string), string schema = default(string), string contentVersion = default(string), object parameters = default(object), IList resources = default(IList)) + : base(id) + { + Schema = schema; + ContentVersion = contentVersion; + Parameters = parameters; + Resources = resources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the schema of the captured virtual machine + /// + [JsonProperty(PropertyName = "$schema")] + public string Schema { get; private set; } + + /// + /// Gets the version of the content + /// + [JsonProperty(PropertyName = "contentVersion")] + public string ContentVersion { get; private set; } + + /// + /// Gets parameters of the captured virtual machine + /// + [JsonProperty(PropertyName = "parameters")] + public object Parameters { get; private set; } + + /// + /// Gets a list of resource items of the captured virtual machine + /// + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineEvictionPolicyTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineEvictionPolicyTypes.cs new file mode 100644 index 0000000000000..94370101fd0cd --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineEvictionPolicyTypes.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 VirtualMachineEvictionPolicyTypes. + /// + public static class VirtualMachineEvictionPolicyTypes + { + public const string Deallocate = "Deallocate"; + public const string Delete = "Delete"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtension.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtension.cs new file mode 100644 index 0000000000000..59623078abb0d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtension.cs @@ -0,0 +1,168 @@ +// +// 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; + + /// + /// Describes a Virtual Machine Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineExtension : Resource + { + /// + /// Initializes a new instance of the VirtualMachineExtension class. + /// + public VirtualMachineExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineExtension class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// 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 VirtualMachineExtension(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string forceUpdateTag = default(string), string publisher = default(string), string virtualMachineExtensionType = 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(location, id, name, type, tags) + { + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + VirtualMachineExtensionType = virtualMachineExtensionType; + 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 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 VirtualMachineExtensionType { 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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs new file mode 100644 index 0000000000000..ba3f55442e06e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs @@ -0,0 +1,72 @@ +// +// 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 instance view of a virtual machine extension handler. + /// + public partial class VirtualMachineExtensionHandlerInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionHandlerInstanceView class. + /// + public VirtualMachineExtensionHandlerInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionHandlerInstanceView class. + /// + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// The extension handler status. + public VirtualMachineExtensionHandlerInstanceView(string type = default(string), string typeHandlerVersion = default(string), InstanceViewStatus status = default(InstanceViewStatus)) + { + Type = type; + TypeHandlerVersion = typeHandlerVersion; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets the extension handler status. + /// + [JsonProperty(PropertyName = "status")] + public InstanceViewStatus Status { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionImage.cs new file mode 100644 index 0000000000000..a402046384be0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionImage.cs @@ -0,0 +1,132 @@ +// +// 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; + + /// + /// Describes a Virtual Machine Extension Image. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineExtensionImage : Resource + { + /// + /// Initializes a new instance of the VirtualMachineExtensionImage + /// class. + /// + public VirtualMachineExtensionImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineExtensionImage + /// class. + /// + /// Resource location + /// The operating system this extension + /// supports. + /// The type of role (IaaS or PaaS) this + /// extension supports. + /// The schema defined by publisher, where + /// extension consumers should provide settings in a matching + /// schema. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Whether the extension can be used + /// on xRP VMScaleSets. By default existing extensions are usable on + /// scalesets, but there might be cases where a publisher wants to + /// explicitly indicate the extension is only enabled for CRP VMs but + /// not VMSS. + /// Whether the handler can + /// support multiple extensions. + public VirtualMachineExtensionImage(string location, string operatingSystem, string computeRole, string handlerSchema, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), bool? vmScaleSetEnabled = default(bool?), bool? supportsMultipleExtensions = default(bool?)) + : base(location, id, name, type, tags) + { + OperatingSystem = operatingSystem; + ComputeRole = computeRole; + HandlerSchema = handlerSchema; + VmScaleSetEnabled = vmScaleSetEnabled; + SupportsMultipleExtensions = supportsMultipleExtensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operating system this extension supports. + /// + [JsonProperty(PropertyName = "properties.operatingSystem")] + public string OperatingSystem { get; set; } + + /// + /// Gets or sets the type of role (IaaS or PaaS) this extension + /// supports. + /// + [JsonProperty(PropertyName = "properties.computeRole")] + public string ComputeRole { get; set; } + + /// + /// Gets or sets the schema defined by publisher, where extension + /// consumers should provide settings in a matching schema. + /// + [JsonProperty(PropertyName = "properties.handlerSchema")] + public string HandlerSchema { get; set; } + + /// + /// Gets or sets whether the extension can be used on xRP VMScaleSets. + /// By default existing extensions are usable on scalesets, but there + /// might be cases where a publisher wants to explicitly indicate the + /// extension is only enabled for CRP VMs but not VMSS. + /// + [JsonProperty(PropertyName = "properties.vmScaleSetEnabled")] + public bool? VmScaleSetEnabled { get; set; } + + /// + /// Gets or sets whether the handler can support multiple extensions. + /// + [JsonProperty(PropertyName = "properties.supportsMultipleExtensions")] + public bool? SupportsMultipleExtensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (OperatingSystem == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatingSystem"); + } + if (ComputeRole == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ComputeRole"); + } + if (HandlerSchema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HandlerSchema"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.cs new file mode 100644 index 0000000000000..2104b94125d76 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.cs @@ -0,0 +1,90 @@ +// +// 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 a virtual machine extension. + /// + public partial class VirtualMachineExtensionInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionInstanceView class. + /// + public VirtualMachineExtensionInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionInstanceView class. + /// + /// The virtual machine extension name. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// The resource status information. + /// The resource status information. + public VirtualMachineExtensionInstanceView(string name = default(string), string type = default(string), string typeHandlerVersion = default(string), IList substatuses = default(IList), IList statuses = default(IList)) + { + Name = name; + Type = type; + TypeHandlerVersion = typeHandlerVersion; + Substatuses = substatuses; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine extension name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "substatuses")] + public IList Substatuses { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionUpdate.cs new file mode 100644 index 0000000000000..6c174a0af75ff --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionUpdate.cs @@ -0,0 +1,138 @@ +// +// 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; + + /// + /// Describes a Virtual Machine Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineExtensionUpdate : UpdateResource + { + /// + /// Initializes a new instance of the VirtualMachineExtensionUpdate + /// class. + /// + public VirtualMachineExtensionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineExtensionUpdate + /// class. + /// + /// Resource tags + /// 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 VirtualMachineExtensionUpdate(IDictionary tags = default(IDictionary), string forceUpdateTag = default(string), string publisher = default(string), string type = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object)) + : base(tags) + { + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type = type; + 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 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 Type { 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/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.cs new file mode 100644 index 0000000000000..b499926d72acd --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.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 Extension operation response + /// + public partial class VirtualMachineExtensionsListResult + { + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionsListResult class. + /// + public VirtualMachineExtensionsListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionsListResult class. + /// + /// The list of extensions + public VirtualMachineExtensionsListResult(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 extensions + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineHealthStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineHealthStatus.cs new file mode 100644 index 0000000000000..76ab1b356e58c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineHealthStatus.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; + + /// + /// The health status of the VM. + /// + public partial class VirtualMachineHealthStatus + { + /// + /// Initializes a new instance of the VirtualMachineHealthStatus class. + /// + public VirtualMachineHealthStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineHealthStatus class. + /// + /// The health status information for the + /// VM. + public VirtualMachineHealthStatus(InstanceViewStatus status = default(InstanceViewStatus)) + { + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the health status information for the VM. + /// + [JsonProperty(PropertyName = "status")] + public InstanceViewStatus Status { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineIdentity.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineIdentity.cs new file mode 100644 index 0000000000000..e0f9039ee23d9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineIdentity.cs @@ -0,0 +1,99 @@ +// +// 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; + + /// + /// Identity for the virtual machine. + /// + public partial class VirtualMachineIdentity + { + /// + /// Initializes a new instance of the VirtualMachineIdentity class. + /// + public VirtualMachineIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineIdentity class. + /// + /// The principal id of virtual machine + /// identity. This property will only be provided for a system assigned + /// identity. + /// The tenant id associated with the virtual + /// machine. This property will only be provided for a system assigned + /// identity. + /// The type of identity used for the virtual + /// machine. The type 'SystemAssigned, UserAssigned' includes both an + /// implicitly created identity and a set of user assigned identities. + /// The type 'None' will remove any identities from the virtual + /// machine. Possible values include: 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned, UserAssigned', 'None' + /// The list of user identities + /// associated with the Virtual Machine. The user identity dictionary + /// key references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public VirtualMachineIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of virtual machine identity. This property + /// will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id associated with the virtual machine. This + /// property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the type of identity used for the virtual machine. The + /// type 'SystemAssigned, UserAssigned' includes both an implicitly + /// created identity and a set of user assigned identities. The type + /// 'None' will remove any identities from the virtual machine. + /// Possible values include: 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned, UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + /// + /// Gets or sets the list of user identities associated with the + /// Virtual Machine. The user identity dictionary key references will + /// be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineIdentityUserAssignedIdentitiesValue.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineIdentityUserAssignedIdentitiesValue.cs new file mode 100644 index 0000000000000..a45f299a19e20 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineIdentityUserAssignedIdentitiesValue.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class VirtualMachineIdentityUserAssignedIdentitiesValue + { + /// + /// Initializes a new instance of the + /// VirtualMachineIdentityUserAssignedIdentitiesValue class. + /// + public VirtualMachineIdentityUserAssignedIdentitiesValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineIdentityUserAssignedIdentitiesValue class. + /// + /// The principal id of user assigned + /// identity. + /// The client id of user assigned + /// identity. + public VirtualMachineIdentityUserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImage.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImage.cs new file mode 100644 index 0000000000000..f7d1df4a903c9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImage.cs @@ -0,0 +1,124 @@ +// +// 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; + + /// + /// Describes a Virtual Machine Image. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineImage : VirtualMachineImageResource + { + /// + /// Initializes a new instance of the VirtualMachineImage class. + /// + public VirtualMachineImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineImage class. + /// + /// The name of the resource. + /// The supported Azure location of the + /// resource. + /// Resource Id + /// Specifies the tags that are assigned to the + /// virtual machine. For more information about using tags, see [Using + /// tags to organize your Azure + /// resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + /// The extended location of the Virtual + /// Machine. + /// Possible values include: 'V1', + /// 'V2' + /// Specifies disallowed configuration for the + /// VirtualMachine created from the image + public VirtualMachineImage(string name, string location, string id = default(string), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation), PurchasePlan plan = default(PurchasePlan), OSDiskImage osDiskImage = default(OSDiskImage), IList dataDiskImages = default(IList), AutomaticOSUpgradeProperties automaticOSUpgradeProperties = default(AutomaticOSUpgradeProperties), string hyperVGeneration = default(string), DisallowedConfiguration disallowed = default(DisallowedConfiguration)) + : base(name, location, id, tags, extendedLocation) + { + Plan = plan; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + AutomaticOSUpgradeProperties = automaticOSUpgradeProperties; + HyperVGeneration = hyperVGeneration; + Disallowed = disallowed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.plan")] + public PurchasePlan Plan { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.osDiskImage")] + public OSDiskImage OsDiskImage { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.dataDiskImages")] + public IList DataDiskImages { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.automaticOSUpgradeProperties")] + public AutomaticOSUpgradeProperties AutomaticOSUpgradeProperties { get; set; } + + /// + /// Gets or sets possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets specifies disallowed configuration for the + /// VirtualMachine created from the image + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public DisallowedConfiguration Disallowed { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Plan != null) + { + Plan.Validate(); + } + if (OsDiskImage != null) + { + OsDiskImage.Validate(); + } + if (AutomaticOSUpgradeProperties != null) + { + AutomaticOSUpgradeProperties.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImageResource.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImageResource.cs new file mode 100644 index 0000000000000..174b5698e0ec1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImageResource.cs @@ -0,0 +1,111 @@ +// +// 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; + + /// + /// Virtual machine image resource information. + /// + public partial class VirtualMachineImageResource : SubResource + { + /// + /// Initializes a new instance of the VirtualMachineImageResource + /// class. + /// + public VirtualMachineImageResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineImageResource + /// class. + /// + /// The name of the resource. + /// The supported Azure location of the + /// resource. + /// Resource Id + /// Specifies the tags that are assigned to the + /// virtual machine. For more information about using tags, see [Using + /// tags to organize your Azure + /// resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + /// The extended location of the Virtual + /// Machine. + public VirtualMachineImageResource(string name, string location, string id = default(string), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(id) + { + Name = name; + Location = location; + Tags = tags; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the supported Azure location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets specifies the tags that are assigned to the virtual + /// machine. For more information about using tags, see [Using tags to + /// organize your Azure + /// resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the extended location of the Virtual Machine. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesParameters.cs new file mode 100644 index 0000000000000..e7170d046d5b0 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesParameters.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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input for InstallPatches as directly received by the API + /// + public partial class VirtualMachineInstallPatchesParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesParameters class. + /// + public VirtualMachineInstallPatchesParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesParameters class. + /// + /// Specifies the maximum amount of time + /// that the operation will run. It must be an ISO 8601-compliant + /// duration string such as PT4H (4 hours) + /// Defines when it is acceptable to reboot + /// a VM during a software update operation. Possible values include: + /// 'IfRequired', 'Never', 'Always' + /// Input for InstallPatches on a + /// Windows VM, as directly received by the API + /// Input for InstallPatches on a Linux + /// VM, as directly received by the API + public VirtualMachineInstallPatchesParameters(string maximumDuration, string rebootSetting, WindowsParameters windowsParameters = default(WindowsParameters), LinuxParameters linuxParameters = default(LinuxParameters)) + { + MaximumDuration = maximumDuration; + RebootSetting = rebootSetting; + WindowsParameters = windowsParameters; + LinuxParameters = linuxParameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the maximum amount of time that the + /// operation will run. It must be an ISO 8601-compliant duration + /// string such as PT4H (4 hours) + /// + [JsonProperty(PropertyName = "maximumDuration")] + public string MaximumDuration { get; set; } + + /// + /// Gets or sets defines when it is acceptable to reboot a VM during a + /// software update operation. Possible values include: 'IfRequired', + /// 'Never', 'Always' + /// + [JsonProperty(PropertyName = "rebootSetting")] + public string RebootSetting { get; set; } + + /// + /// Gets or sets input for InstallPatches on a Windows VM, as directly + /// received by the API + /// + [JsonProperty(PropertyName = "windowsParameters")] + public WindowsParameters WindowsParameters { get; set; } + + /// + /// Gets or sets input for InstallPatches on a Linux VM, as directly + /// received by the API + /// + [JsonProperty(PropertyName = "linuxParameters")] + public LinuxParameters LinuxParameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MaximumDuration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MaximumDuration"); + } + if (RebootSetting == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RebootSetting"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs new file mode 100644 index 0000000000000..53d2c65fe0274 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.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; + + /// + /// The result summary of an installation operation. + /// + public partial class VirtualMachineInstallPatchesResult + { + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesResult class. + /// + public VirtualMachineInstallPatchesResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesResult class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Failed", "Succeeded", "Unknown" or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the + /// operation that produced this result. It is used to correlate across + /// CRP and extension logs. + /// The reboot state of the VM following + /// completion of the operation. Possible values include: 'Unknown', + /// 'NotNeeded', 'Required', 'Started', 'Failed', 'Completed' + /// Whether the operation ran + /// out of time before it completed all its intended actions. + /// The number of patches that were + /// not installed due to the user blocking their installation. + /// The number of patches that were + /// detected as available for install, but did not meet the operation's + /// criteria. + /// The number of patches that were + /// identified as meeting the installation criteria, but were not able + /// to be installed. Typically this happens when + /// maintenanceWindowExceeded == true. + /// The number of patches + /// successfully installed. + /// The number of patches that could not + /// be installed due to some issue. See errors for details. + /// The patches that were installed during the + /// operation. + /// The UTC timestamp when the operation + /// began. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public VirtualMachineInstallPatchesResult(string status = default(string), string installationActivityId = default(string), string rebootStatus = default(string), bool? maintenanceWindowExceeded = default(bool?), int? excludedPatchCount = default(int?), int? notSelectedPatchCount = default(int?), int? pendingPatchCount = default(int?), int? installedPatchCount = default(int?), int? failedPatchCount = default(int?), IList patches = default(IList), System.DateTime? startDateTime = default(System.DateTime?), ApiError error = default(ApiError)) + { + Status = status; + InstallationActivityId = installationActivityId; + RebootStatus = rebootStatus; + MaintenanceWindowExceeded = maintenanceWindowExceeded; + ExcludedPatchCount = excludedPatchCount; + NotSelectedPatchCount = notSelectedPatchCount; + PendingPatchCount = pendingPatchCount; + InstalledPatchCount = installedPatchCount; + FailedPatchCount = failedPatchCount; + Patches = patches; + StartDateTime = startDateTime; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Failed", "Succeeded", "Unknown" or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "installationActivityId")] + public string InstallationActivityId { get; private set; } + + /// + /// Gets the reboot state of the VM following completion of the + /// operation. Possible values include: 'Unknown', 'NotNeeded', + /// 'Required', 'Started', 'Failed', 'Completed' + /// + [JsonProperty(PropertyName = "rebootStatus")] + public string RebootStatus { get; private set; } + + /// + /// Gets whether the operation ran out of time before it completed all + /// its intended actions. + /// + [JsonProperty(PropertyName = "maintenanceWindowExceeded")] + public bool? MaintenanceWindowExceeded { get; private set; } + + /// + /// Gets the number of patches that were not installed due to the user + /// blocking their installation. + /// + [JsonProperty(PropertyName = "excludedPatchCount")] + public int? ExcludedPatchCount { get; private set; } + + /// + /// Gets the number of patches that were detected as available for + /// install, but did not meet the operation's criteria. + /// + [JsonProperty(PropertyName = "notSelectedPatchCount")] + public int? NotSelectedPatchCount { get; private set; } + + /// + /// Gets the number of patches that were identified as meeting the + /// installation criteria, but were not able to be installed. Typically + /// this happens when maintenanceWindowExceeded == true. + /// + [JsonProperty(PropertyName = "pendingPatchCount")] + public int? PendingPatchCount { get; private set; } + + /// + /// Gets the number of patches successfully installed. + /// + [JsonProperty(PropertyName = "installedPatchCount")] + public int? InstalledPatchCount { get; private set; } + + /// + /// Gets the number of patches that could not be installed due to some + /// issue. See errors for details. + /// + [JsonProperty(PropertyName = "failedPatchCount")] + public int? FailedPatchCount { get; private set; } + + /// + /// Gets the patches that were installed during the operation. + /// + [JsonProperty(PropertyName = "patches")] + public IList Patches { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstanceView.cs new file mode 100644 index 0000000000000..d0140ccba2555 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstanceView.cs @@ -0,0 +1,204 @@ +// +// 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 a virtual machine. + /// + public partial class VirtualMachineInstanceView + { + /// + /// Initializes a new instance of the VirtualMachineInstanceView class. + /// + public VirtualMachineInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineInstanceView class. + /// + /// Specifies the update domain of + /// the virtual machine. + /// Specifies the fault domain of the + /// virtual machine. + /// The computer name assigned to the + /// virtual machine. + /// The Operating System running on the virtual + /// machine. + /// The version of Operating System running on + /// the virtual machine. + /// Specifies the HyperVGeneration Type + /// associated with a resource. Possible values include: 'V1', + /// 'V2' + /// The Remote desktop certificate + /// thumbprint. + /// The VM Agent running on the virtual + /// machine. + /// The Maintenance Operation + /// status on the virtual machine. + /// The virtual machine disk information. + /// The extensions information. + /// The health status for the VM. + /// Boot Diagnostics is a debugging + /// feature which allows you to view Console Output and Screenshot to + /// diagnose VM status. <br><br> You can easily view the + /// output of your console log. <br><br> Azure also enables + /// you to see a screenshot of the VM from the hypervisor. + /// Resource id of the dedicated host, on + /// which the virtual machine is allocated through automatic placement, + /// when the virtual machine is associated with a dedicated host group + /// that has automatic placement enabled. <br><br>Minimum + /// api-version: 2020-06-01. + /// The resource status information. + /// The status of virtual machine patch + /// operations. + public VirtualMachineInstanceView(int? platformUpdateDomain = default(int?), int? platformFaultDomain = default(int?), string computerName = default(string), string osName = default(string), string osVersion = default(string), string hyperVGeneration = default(string), string rdpThumbPrint = default(string), VirtualMachineAgentInstanceView vmAgent = default(VirtualMachineAgentInstanceView), MaintenanceRedeployStatus maintenanceRedeployStatus = default(MaintenanceRedeployStatus), IList disks = default(IList), IList extensions = default(IList), VirtualMachineHealthStatus vmHealth = default(VirtualMachineHealthStatus), BootDiagnosticsInstanceView bootDiagnostics = default(BootDiagnosticsInstanceView), string assignedHost = default(string), IList statuses = default(IList), VirtualMachinePatchStatus patchStatus = default(VirtualMachinePatchStatus)) + { + PlatformUpdateDomain = platformUpdateDomain; + PlatformFaultDomain = platformFaultDomain; + ComputerName = computerName; + OsName = osName; + OsVersion = osVersion; + HyperVGeneration = hyperVGeneration; + RdpThumbPrint = rdpThumbPrint; + VmAgent = vmAgent; + MaintenanceRedeployStatus = maintenanceRedeployStatus; + Disks = disks; + Extensions = extensions; + VmHealth = vmHealth; + BootDiagnostics = bootDiagnostics; + AssignedHost = assignedHost; + Statuses = statuses; + PatchStatus = patchStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the update domain of the virtual machine. + /// + [JsonProperty(PropertyName = "platformUpdateDomain")] + public int? PlatformUpdateDomain { get; set; } + + /// + /// Gets or sets specifies the fault domain of the virtual machine. + /// + [JsonProperty(PropertyName = "platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets the computer name assigned to the virtual machine. + /// + [JsonProperty(PropertyName = "computerName")] + public string ComputerName { get; set; } + + /// + /// Gets or sets the Operating System running on the virtual machine. + /// + [JsonProperty(PropertyName = "osName")] + public string OsName { get; set; } + + /// + /// Gets or sets the version of Operating System running on the virtual + /// machine. + /// + [JsonProperty(PropertyName = "osVersion")] + public string OsVersion { get; set; } + + /// + /// Gets or sets specifies the HyperVGeneration Type associated with a + /// resource. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets the Remote desktop certificate thumbprint. + /// + [JsonProperty(PropertyName = "rdpThumbPrint")] + public string RdpThumbPrint { get; set; } + + /// + /// Gets or sets the VM Agent running on the virtual machine. + /// + [JsonProperty(PropertyName = "vmAgent")] + public VirtualMachineAgentInstanceView VmAgent { get; set; } + + /// + /// Gets or sets the Maintenance Operation status on the virtual + /// machine. + /// + [JsonProperty(PropertyName = "maintenanceRedeployStatus")] + public MaintenanceRedeployStatus MaintenanceRedeployStatus { get; set; } + + /// + /// Gets or sets the virtual machine disk information. + /// + [JsonProperty(PropertyName = "disks")] + public IList Disks { get; set; } + + /// + /// Gets or sets the extensions information. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + /// + /// Gets the health status for the VM. + /// + [JsonProperty(PropertyName = "vmHealth")] + public VirtualMachineHealthStatus VmHealth { get; private set; } + + /// + /// Gets or sets boot Diagnostics is a debugging feature which allows + /// you to view Console Output and Screenshot to diagnose VM status. + /// &lt;br&gt;&lt;br&gt; You can easily view the output + /// of your console log. &lt;br&gt;&lt;br&gt; Azure + /// also enables you to see a screenshot of the VM from the hypervisor. + /// + [JsonProperty(PropertyName = "bootDiagnostics")] + public BootDiagnosticsInstanceView BootDiagnostics { get; set; } + + /// + /// Gets resource id of the dedicated host, on which the virtual + /// machine is allocated through automatic placement, when the virtual + /// machine is associated with a dedicated host group that has + /// automatic placement enabled. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "assignedHost")] + public string AssignedHost { get; private set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets or sets the status of virtual machine patch operations. + /// + [JsonProperty(PropertyName = "patchStatus")] + public VirtualMachinePatchStatus PatchStatus { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs new file mode 100644 index 0000000000000..bd1b95c7f6352 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs @@ -0,0 +1,75 @@ +// +// 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 status of virtual machine patch operations. + /// + public partial class VirtualMachinePatchStatus + { + /// + /// Initializes a new instance of the VirtualMachinePatchStatus class. + /// + public VirtualMachinePatchStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachinePatchStatus class. + /// + /// The available patch summary of + /// the latest assessment operation for the virtual machine. + /// The installation summary + /// of the latest installation operation for the virtual + /// machine. + /// The enablement status of the + /// specified patchMode + public VirtualMachinePatchStatus(AvailablePatchSummary availablePatchSummary = default(AvailablePatchSummary), LastPatchInstallationSummary lastPatchInstallationSummary = default(LastPatchInstallationSummary), IList configurationStatuses = default(IList)) + { + AvailablePatchSummary = availablePatchSummary; + LastPatchInstallationSummary = lastPatchInstallationSummary; + ConfigurationStatuses = configurationStatuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the available patch summary of the latest assessment + /// operation for the virtual machine. + /// + [JsonProperty(PropertyName = "availablePatchSummary")] + public AvailablePatchSummary AvailablePatchSummary { get; set; } + + /// + /// Gets or sets the installation summary of the latest installation + /// operation for the virtual machine. + /// + [JsonProperty(PropertyName = "lastPatchInstallationSummary")] + public LastPatchInstallationSummary LastPatchInstallationSummary { get; set; } + + /// + /// Gets the enablement status of the specified patchMode + /// + [JsonProperty(PropertyName = "configurationStatuses")] + public IList ConfigurationStatuses { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePriorityTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePriorityTypes.cs new file mode 100644 index 0000000000000..6a5d628ee3e3e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePriorityTypes.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 VirtualMachinePriorityTypes. + /// + public static class VirtualMachinePriorityTypes + { + public const string Regular = "Regular"; + public const string Low = "Low"; + public const string Spot = "Spot"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineReimageParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineReimageParameters.cs new file mode 100644 index 0000000000000..8968579d4f8aa --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineReimageParameters.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk + /// will always be reimaged + /// + public partial class VirtualMachineReimageParameters + { + /// + /// Initializes a new instance of the VirtualMachineReimageParameters + /// class. + /// + public VirtualMachineReimageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineReimageParameters + /// class. + /// + /// Specifies whether to reimage temp disk. + /// Default value: false. Note: This temp disk reimage parameter is + /// only supported for VM/VMSS with Ephemeral OS disk. + public VirtualMachineReimageParameters(bool? tempDisk = default(bool?)) + { + TempDisk = tempDisk; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether to reimage temp disk. Default value: + /// false. Note: This temp disk reimage parameter is only supported for + /// VM/VMSS with Ephemeral OS disk. + /// + [JsonProperty(PropertyName = "tempDisk")] + public bool? TempDisk { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs new file mode 100644 index 0000000000000..df3fcdf217e2c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs @@ -0,0 +1,306 @@ +// +// 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; + + /// + /// Describes a Virtual Machine Scale Set. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSet : Resource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSet class. + /// + public VirtualMachineScaleSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine scale set sku. + /// Specifies information about the marketplace + /// image used to create the virtual machine. This element is only used + /// for marketplace images. Before you can use a marketplace image from + /// an API, you must enable the image for programmatic use. In the + /// Azure portal, find the marketplace image that you want to use and + /// then click **Want to deploy programmatically, Get Started ->**. + /// Enter any required information and then click **Save**. + /// The upgrade policy. + /// Policy for automatic + /// repairs. + /// The virtual machine + /// profile. + /// The provisioning state, which only + /// appears in the response. + /// Specifies whether the Virtual Machine + /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. + /// Specifies the ID which uniquely identifies a + /// Virtual Machine Scale Set. + /// When true this limits the scale + /// set to a single placement group, of max size 100 virtual machines. + /// NOTE: If singlePlacementGroup is true, it may be modified to false. + /// However, if singlePlacementGroup is false, it may not be modified + /// to true. + /// Whether to force strictly even Virtual + /// Machine distribution cross x-zones in case there is zone + /// outage. + /// Fault Domain count for each + /// placement group. + /// Specifies information about + /// the proximity placement group that the virtual machine scale set + /// should be assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies information about the dedicated + /// host group that the virtual machine scale set resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// Specifies additional + /// capabilities enabled or disabled on the Virtual Machines in the + /// Virtual Machine Scale Set. For instance: whether the Virtual + /// Machines have the capability to support attaching managed data + /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. + /// Specifies the orchestration mode + /// for the virtual machine scale set. Possible values include: + /// 'Uniform', 'Flexible' + /// The identity of the virtual machine scale + /// set, if configured. + /// The virtual machine scale set zones. NOTE: + /// Availability zones can only be set when you create the scale + /// set + /// The extended location of the Virtual + /// Machine Scale Set. + public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), SubResource hostGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), OrchestrationMode? orchestrationMode = default(OrchestrationMode?), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = orchestrationMode; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set sku. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets specifies information about the marketplace image used + /// to create the virtual machine. This element is only used for + /// marketplace images. Before you can use a marketplace image from an + /// API, you must enable the image for programmatic use. In the Azure + /// portal, find the marketplace image that you want to use and then + /// click **Want to deploy programmatically, Get Started -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets the upgrade policy. + /// + [JsonProperty(PropertyName = "properties.upgradePolicy")] + public UpgradePolicy UpgradePolicy { get; set; } + + /// + /// Gets or sets policy for automatic repairs. + /// + [JsonProperty(PropertyName = "properties.automaticRepairsPolicy")] + public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; } + + /// + /// Gets or sets the virtual machine profile. + /// + [JsonProperty(PropertyName = "properties.virtualMachineProfile")] + public VirtualMachineScaleSetVMProfile VirtualMachineProfile { 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 specifies whether the Virtual Machine Scale Set should + /// be overprovisioned. + /// + [JsonProperty(PropertyName = "properties.overprovision")] + public bool? Overprovision { get; set; } + + /// + /// Gets or sets when Overprovision is enabled, extensions are launched + /// only on the requested number of VMs which are finally kept. This + /// property will hence ensure that the extensions do not run on the + /// extra overprovisioned VMs. + /// + [JsonProperty(PropertyName = "properties.doNotRunExtensionsOnOverprovisionedVMs")] + public bool? DoNotRunExtensionsOnOverprovisionedVMs { get; set; } + + /// + /// Gets specifies the ID which uniquely identifies a Virtual Machine + /// Scale Set. + /// + [JsonProperty(PropertyName = "properties.uniqueId")] + public string UniqueId { get; private set; } + + /// + /// Gets or sets when true this limits the scale set to a single + /// placement group, of max size 100 virtual machines. NOTE: If + /// singlePlacementGroup is true, it may be modified to false. However, + /// if singlePlacementGroup is false, it may not be modified to true. + /// + [JsonProperty(PropertyName = "properties.singlePlacementGroup")] + public bool? SinglePlacementGroup { get; set; } + + /// + /// Gets or sets whether to force strictly even Virtual Machine + /// distribution cross x-zones in case there is zone outage. + /// + [JsonProperty(PropertyName = "properties.zoneBalance")] + public bool? ZoneBalance { get; set; } + + /// + /// Gets or sets fault Domain count for each placement group. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine scale set should be assigned to. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host group + /// that the virtual machine scale set resides in. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "properties.hostGroup")] + public SubResource HostGroup { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the Virtual Machines in the Virtual Machine Scale Set. For + /// instance: whether the Virtual Machines have the capability to + /// support attaching managed data disks with UltraSSD_LRS storage + /// account type. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the scale-in policy that decides which + /// virtual machines are chosen for removal when a Virtual Machine + /// Scale Set is scaled-in. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + + /// + /// Gets or sets specifies the orchestration mode for the virtual + /// machine scale set. Possible values include: 'Uniform', 'Flexible' + /// + [JsonProperty(PropertyName = "properties.orchestrationMode")] + public OrchestrationMode? OrchestrationMode { get; set; } + + /// + /// Gets or sets the identity of the virtual machine scale set, if + /// configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineScaleSetIdentity Identity { get; set; } + + /// + /// Gets or sets the virtual machine scale set zones. NOTE: + /// Availability zones can only be set when you create the scale set + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets or sets the extended location of the Virtual Machine Scale + /// Set. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (UpgradePolicy != null) + { + UpgradePolicy.Validate(); + } + if (VirtualMachineProfile != null) + { + VirtualMachineProfile.Validate(); + } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs new file mode 100644 index 0000000000000..e6a6744dcd770 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs @@ -0,0 +1,169 @@ +// +// 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; + + /// + /// Describes a virtual machine scale set data disk. + /// + public partial class VirtualMachineScaleSetDataDisk + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetDataDisk + /// class. + /// + public VirtualMachineScaleSetDataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetDataDisk + /// class. + /// + /// Specifies the logical unit number of the data + /// disk. This value is used to identify data disks within the VM and + /// therefore must be unique for each data disk attached to a + /// VM. + /// The create option. Possible values + /// include: 'FromImage', 'Empty', 'Attach' + /// The disk name. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. <br><br> This value + /// cannot be larger than 1023 GB + /// The managed disk parameters. + /// Specifies the Read-Write IOPS for + /// the managed disk. Should be used only when StorageAccountType is + /// UltraSSD_LRS. If not specified, a default value would be assigned + /// based on diskSizeGB. + /// Specifies the bandwidth in MB per + /// second for the managed disk. Should be used only when + /// StorageAccountType is UltraSSD_LRS. If not specified, a default + /// value would be assigned based on diskSizeGB. + public VirtualMachineScaleSetDataDisk(int lun, string createOption, string name = default(string), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?)) + { + Name = name; + Lun = lun; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CreateOption = createOption; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the logical unit number of the data disk. + /// This value is used to identify data disks within the VM and + /// therefore must be unique for each data disk attached to a VM. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Gets or sets specifies the caching requirements. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **ReadOnly** + /// &lt;br&gt;&lt;br&gt; **ReadWrite** + /// &lt;br&gt;&lt;br&gt; Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets the create option. Possible values include: + /// 'FromImage', 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. &lt;br&gt;&lt;br&gt; This + /// value cannot be larger than 1023 GB + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets specifies the Read-Write IOPS for the managed disk. + /// Should be used only when StorageAccountType is UltraSSD_LRS. If not + /// specified, a default value would be assigned based on diskSizeGB. + /// + [JsonProperty(PropertyName = "diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; set; } + + /// + /// Gets or sets specifies the bandwidth in MB per second for the + /// managed disk. Should be used only when StorageAccountType is + /// UltraSSD_LRS. If not specified, a default value would be assigned + /// based on diskSizeGB. + /// + [JsonProperty(PropertyName = "diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtension.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtension.cs new file mode 100644 index 0000000000000..b3335850a43e1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtension.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetExtension : SubResourceReadOnly + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetExtension + /// class. + /// + public VirtualMachineScaleSetExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetExtension + /// class. + /// + /// Resource Id + /// The name of the extension. + /// Resource type + /// If a value is provided and is + /// different from the previous value, the extension handler will 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. + /// Collection of extension + /// names after which this extension needs to be provisioned. + public VirtualMachineScaleSetExtension(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), IList provisionAfterExtensions = default(IList)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + ProvisionAfterExtensions = provisionAfterExtensions; + 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; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets if a value is provided and is different from the + /// previous value, the extension handler will 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 collection of extension names after which this + /// extension needs to be provisioned. + /// + [JsonProperty(PropertyName = "properties.provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs new file mode 100644 index 0000000000000..232299d9705fb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs @@ -0,0 +1,74 @@ +// +// 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 virtual machine scale set extension profile. + /// + public partial class VirtualMachineScaleSetExtensionProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionProfile class. + /// + public VirtualMachineScaleSetExtensionProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionProfile class. + /// + /// The virtual machine scale set child + /// extension resources. + /// Specifies the time alloted for + /// all extensions to start. The time duration should be between 15 + /// minutes and 120 minutes (inclusive) and should be specified in ISO + /// 8601 format. The default value is 90 minutes (PT1H30M). + /// <br><br> Minimum api-version: 2020-06-01 + public VirtualMachineScaleSetExtensionProfile(IList extensions = default(IList), string extensionsTimeBudget = default(string)) + { + Extensions = extensions; + ExtensionsTimeBudget = extensionsTimeBudget; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set child extension + /// resources. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + /// + /// Gets or sets specifies the time alloted for all extensions to + /// start. The time duration should be between 15 minutes and 120 + /// minutes (inclusive) and should be specified in ISO 8601 format. The + /// default value is 90 minutes (PT1H30M). + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2020-06-01 + /// + [JsonProperty(PropertyName = "extensionsTimeBudget")] + public string ExtensionsTimeBudget { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs new file mode 100644 index 0000000000000..02b6167f5f7dc --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetExtensionUpdate : SubResourceReadOnly + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionUpdate class. + /// + public VirtualMachineScaleSetExtensionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionUpdate class. + /// + /// Resource Id + /// The name of the extension. + /// Resource type + /// If a value is provided and is + /// different from the previous value, the extension handler will 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. + /// Collection of extension + /// names after which this extension needs to be provisioned. + public VirtualMachineScaleSetExtensionUpdate(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), IList provisionAfterExtensions = default(IList)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + ProvisionAfterExtensions = provisionAfterExtensions; + 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 if a value is provided and is different from the + /// previous value, the extension handler will 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 collection of extension names after which this + /// extension needs to be provisioned. + /// + [JsonProperty(PropertyName = "properties.provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs new file mode 100644 index 0000000000000..261206a71597c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs @@ -0,0 +1,176 @@ +// +// 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; + + /// + /// Describes a virtual machine scale set network profile's IP + /// configuration. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetIPConfiguration : SubResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetIPConfiguration class. + /// + public VirtualMachineScaleSetIPConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetIPConfiguration class. + /// + /// The IP configuration name. + /// Resource Id + /// Specifies the identifier of the + /// subnet. + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + /// The + /// publicIPAddressConfiguration. + /// Available from Api-Version + /// 2017-03-30 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + /// Possible values are: 'IPv4' and 'IPv6'. Possible values include: + /// 'IPv4', 'IPv6' + /// Specifies an + /// array of references to backend address pools of application + /// gateways. A scale set can reference backend address pools of + /// multiple application gateways. Multiple scale sets cannot use the + /// same application gateway. + /// Specifies an array of + /// references to application security group. + /// Specifies an array of + /// references to backend address pools of load balancers. A scale set + /// can reference backend address pools of one public and one internal + /// load balancer. Multiple scale sets cannot use the same basic sku + /// load balancer. + /// Specifies an array of + /// references to inbound Nat pools of the load balancers. A scale set + /// can reference inbound nat pools of one public and one internal load + /// balancer. Multiple scale sets cannot use the same basic sku load + /// balancer. + public VirtualMachineScaleSetIPConfiguration(string name, string id = default(string), ApiEntityReference subnet = default(ApiEntityReference), bool? primary = default(bool?), VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration = default(VirtualMachineScaleSetPublicIPAddressConfiguration), string privateIPAddressVersion = default(string), IList applicationGatewayBackendAddressPools = default(IList), IList applicationSecurityGroups = default(IList), IList loadBalancerBackendAddressPools = default(IList), IList loadBalancerInboundNatPools = default(IList)) + : base(id) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + ApplicationSecurityGroups = applicationSecurityGroups; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + LoadBalancerInboundNatPools = loadBalancerInboundNatPools; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the IP configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the identifier of the subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public ApiEntityReference Subnet { get; set; } + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets the publicIPAddressConfiguration. + /// + [JsonProperty(PropertyName = "properties.publicIPAddressConfiguration")] + public VirtualMachineScaleSetPublicIPAddressConfiguration PublicIPAddressConfiguration { get; set; } + + /// + /// Gets or sets available from Api-Version 2017-03-30 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.privateIPAddressVersion")] + public string PrivateIPAddressVersion { get; set; } + + /// + /// Gets or sets specifies an array of references to backend address + /// pools of application gateways. A scale set can reference backend + /// address pools of multiple application gateways. Multiple scale sets + /// cannot use the same application gateway. + /// + [JsonProperty(PropertyName = "properties.applicationGatewayBackendAddressPools")] + public IList ApplicationGatewayBackendAddressPools { get; set; } + + /// + /// Gets or sets specifies an array of references to application + /// security group. + /// + [JsonProperty(PropertyName = "properties.applicationSecurityGroups")] + public IList ApplicationSecurityGroups { get; set; } + + /// + /// Gets or sets specifies an array of references to backend address + /// pools of load balancers. A scale set can reference backend address + /// pools of one public and one internal load balancer. Multiple scale + /// sets cannot use the same basic sku load balancer. + /// + [JsonProperty(PropertyName = "properties.loadBalancerBackendAddressPools")] + public IList LoadBalancerBackendAddressPools { get; set; } + + /// + /// Gets or sets specifies an array of references to inbound Nat pools + /// of the load balancers. A scale set can reference inbound nat pools + /// of one public and one internal load balancer. Multiple scale sets + /// cannot use the same basic sku load balancer. + /// + [JsonProperty(PropertyName = "properties.loadBalancerInboundNatPools")] + public IList LoadBalancerInboundNatPools { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (PublicIPAddressConfiguration != null) + { + PublicIPAddressConfiguration.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIdentity.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIdentity.cs new file mode 100644 index 0000000000000..5c4dfdc0fd5db --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIdentity.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Identity for the virtual machine scale set. + /// + public partial class VirtualMachineScaleSetIdentity + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetIdentity + /// class. + /// + public VirtualMachineScaleSetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetIdentity + /// class. + /// + /// The principal id of virtual machine scale + /// set identity. This property will only be provided for a system + /// assigned identity. + /// The tenant id associated with the virtual + /// machine scale set. This property will only be provided for a system + /// assigned identity. + /// The type of identity used for the virtual + /// machine scale set. The type 'SystemAssigned, UserAssigned' includes + /// both an implicitly created identity and a set of user assigned + /// identities. The type 'None' will remove any identities from the + /// virtual machine scale set. Possible values include: + /// 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', + /// 'None' + /// The list of user identities + /// associated with the virtual machine scale set. The user identity + /// dictionary key references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public VirtualMachineScaleSetIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of virtual machine scale set identity. This + /// property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id associated with the virtual machine scale set. + /// This property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the type of identity used for the virtual machine + /// scale set. The type 'SystemAssigned, UserAssigned' includes both an + /// implicitly created identity and a set of user assigned identities. + /// The type 'None' will remove any identities from the virtual machine + /// scale set. Possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + /// + /// Gets or sets the list of user identities associated with the + /// virtual machine scale set. The user identity dictionary key + /// references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue.cs new file mode 100644 index 0000000000000..232bf55b5ed60 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue class. + /// + public VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue class. + /// + /// The principal id of user assigned + /// identity. + /// The client id of user assigned + /// identity. + public VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.cs new file mode 100644 index 0000000000000..0b6757db7d77d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.cs @@ -0,0 +1,82 @@ +// +// 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 a virtual machine scale set. + /// + public partial class VirtualMachineScaleSetInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceView class. + /// + public VirtualMachineScaleSetInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceView class. + /// + /// The instance view status summary for + /// the virtual machine scale set. + /// The extensions information. + /// The resource status information. + /// The orchestration services + /// information. + public VirtualMachineScaleSetInstanceView(VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine = default(VirtualMachineScaleSetInstanceViewStatusesSummary), IList extensions = default(IList), IList statuses = default(IList), IList orchestrationServices = default(IList)) + { + VirtualMachine = virtualMachine; + Extensions = extensions; + Statuses = statuses; + OrchestrationServices = orchestrationServices; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the instance view status summary for the virtual machine scale + /// set. + /// + [JsonProperty(PropertyName = "virtualMachine")] + public VirtualMachineScaleSetInstanceViewStatusesSummary VirtualMachine { get; private set; } + + /// + /// Gets the extensions information. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; private set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets the orchestration services information. + /// + [JsonProperty(PropertyName = "orchestrationServices")] + public IList OrchestrationServices { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs new file mode 100644 index 0000000000000..2d55aefcac5e7 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.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; + + /// + /// Instance view statuses summary for virtual machines of a virtual + /// machine scale set. + /// + public partial class VirtualMachineScaleSetInstanceViewStatusesSummary + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceViewStatusesSummary class. + /// + public VirtualMachineScaleSetInstanceViewStatusesSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceViewStatusesSummary class. + /// + /// The extensions information. + public VirtualMachineScaleSetInstanceViewStatusesSummary(IList statusesSummary = default(IList)) + { + StatusesSummary = statusesSummary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the extensions information. + /// + [JsonProperty(PropertyName = "statusesSummary")] + public IList StatusesSummary { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIpTag.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIpTag.cs new file mode 100644 index 0000000000000..2fb2b4a7d8128 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIpTag.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// Contains the IP tag associated with the public IP address. + /// + public partial class VirtualMachineScaleSetIpTag + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetIpTag + /// class. + /// + public VirtualMachineScaleSetIpTag() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetIpTag + /// class. + /// + /// IP tag type. Example: + /// FirstPartyUsage. + /// IP tag associated with the public IP. Example: + /// SQL, Storage etc. + public VirtualMachineScaleSetIpTag(string ipTagType = default(string), string tag = default(string)) + { + IpTagType = ipTagType; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets IP tag type. Example: FirstPartyUsage. + /// + [JsonProperty(PropertyName = "ipTagType")] + public string IpTagType { get; set; } + + /// + /// Gets or sets IP tag associated with the public IP. Example: SQL, + /// Storage etc. + /// + [JsonProperty(PropertyName = "tag")] + public string Tag { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs new file mode 100644 index 0000000000000..ca640e2cd0e6c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.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 Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the parameters of a ScaleSet managed disk. + /// + public partial class VirtualMachineScaleSetManagedDiskParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetManagedDiskParameters class. + /// + public VirtualMachineScaleSetManagedDiskParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetManagedDiskParameters class. + /// + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed disk. + public VirtualMachineScaleSetManagedDiskParameters(string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + { + StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the storage account type for the managed + /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it + /// cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs new file mode 100644 index 0000000000000..db8dfda308984 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs @@ -0,0 +1,146 @@ +// +// 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; + + /// + /// Describes a virtual machine scale set network profile's network + /// configurations. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetNetworkConfiguration : SubResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfiguration class. + /// + public VirtualMachineScaleSetNetworkConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfiguration class. + /// + /// The network configuration name. + /// Specifies the IP configurations of + /// the network interface. + /// Resource Id + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + /// Specifies whether the + /// network interface is accelerated networking-enabled. + /// The network security + /// group. + /// The dns settings to be applied on the + /// network interfaces. + /// Whether IP forwarding enabled on + /// this NIC. + public VirtualMachineScaleSetNetworkConfiguration(string name, IList ipConfigurations, string id = default(string), bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), bool? enableIPForwarding = default(bool?)) + : base(id) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the network configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets specifies whether the network interface is accelerated + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableAcceleratedNetworking")] + public bool? EnableAcceleratedNetworking { get; set; } + + /// + /// Gets or sets the network security group. + /// + [JsonProperty(PropertyName = "properties.networkSecurityGroup")] + public SubResource NetworkSecurityGroup { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the network + /// interfaces. + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetNetworkConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Gets or sets specifies the IP configurations of the network + /// interface. + /// + [JsonProperty(PropertyName = "properties.ipConfigurations")] + public IList IpConfigurations { get; set; } + + /// + /// Gets or sets whether IP forwarding enabled on this NIC. + /// + [JsonProperty(PropertyName = "properties.enableIPForwarding")] + public bool? EnableIPForwarding { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (IpConfigurations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IpConfigurations"); + } + if (IpConfigurations != null) + { + foreach (var element in IpConfigurations) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs new file mode 100644 index 0000000000000..4509c496042d2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.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 virtual machines scale sets network configuration's DNS + /// settings. + /// + public partial class VirtualMachineScaleSetNetworkConfigurationDnsSettings + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfigurationDnsSettings class. + /// + public VirtualMachineScaleSetNetworkConfigurationDnsSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfigurationDnsSettings class. + /// + /// List of DNS servers IP addresses + public VirtualMachineScaleSetNetworkConfigurationDnsSettings(IList dnsServers = default(IList)) + { + DnsServers = dnsServers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of DNS servers IP addresses + /// + [JsonProperty(PropertyName = "dnsServers")] + public IList DnsServers { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs new file mode 100644 index 0000000000000..f16e827624250 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile. + /// + public partial class VirtualMachineScaleSetNetworkProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkProfile class. + /// + public VirtualMachineScaleSetNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkProfile class. + /// + /// A reference to a load balancer probe used + /// to determine the health of an instance in the virtual machine scale + /// set. The reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// The list of network + /// configurations. + public VirtualMachineScaleSetNetworkProfile(ApiEntityReference healthProbe = default(ApiEntityReference), IList networkInterfaceConfigurations = default(IList)) + { + HealthProbe = healthProbe; + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a reference to a load balancer probe used to determine + /// the health of an instance in the virtual machine scale set. The + /// reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// + [JsonProperty(PropertyName = "healthProbe")] + public ApiEntityReference HealthProbe { get; set; } + + /// + /// Gets or sets the list of network configurations. + /// + [JsonProperty(PropertyName = "networkInterfaceConfigurations")] + public IList NetworkInterfaceConfigurations { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.cs new file mode 100644 index 0000000000000..e586fafdfe942 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.cs @@ -0,0 +1,192 @@ +// +// 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; + + /// + /// Describes a virtual machine scale set operating system disk. + /// + public partial class VirtualMachineScaleSetOSDisk + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSDisk + /// class. + /// + public VirtualMachineScaleSetOSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSDisk + /// class. + /// + /// Specifies how the virtual machines in + /// the scale set should be created.<br><br> The only + /// allowed value is: **FromImage** \u2013 This value is used when you + /// are using an image to create the virtual machine. If you are using + /// a platform image, you also use the imageReference element described + /// above. If you are using a marketplace image, you also use the plan + /// element previously described. Possible values include: 'FromImage', + /// 'Empty', 'Attach' + /// The disk name. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the ephemeral disk + /// Settings for the operating system disk used by the virtual machine + /// scale set. + /// Specifies the size of the operating system + /// disk in gigabytes. This element can be used to overwrite the size + /// of the disk in a virtual machine image. <br><br> This + /// value cannot be larger than 1023 GB + /// This property allows you to specify the type + /// of the OS that is included in the disk if creating a VM from + /// user-image or a specialized VHD. <br><br> Possible + /// values are: <br><br> **Windows** <br><br> + /// **Linux**. Possible values include: 'Windows', 'Linux' + /// Specifies information about the unmanaged user + /// image to base the scale set on. + /// Specifies the container urls that are + /// used to store operating system disks for the scale set. + /// The managed disk parameters. + public VirtualMachineScaleSetOSDisk(string createOption, string name = default(string), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), DiffDiskSettings diffDiskSettings = default(DiffDiskSettings), int? diskSizeGB = default(int?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), VirtualHardDisk image = default(VirtualHardDisk), IList vhdContainers = default(IList), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters)) + { + Name = name; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CreateOption = createOption; + DiffDiskSettings = diffDiskSettings; + DiskSizeGB = diskSizeGB; + OsType = osType; + Image = image; + VhdContainers = vhdContainers; + ManagedDisk = managedDisk; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the caching requirements. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **ReadOnly** + /// &lt;br&gt;&lt;br&gt; **ReadWrite** + /// &lt;br&gt;&lt;br&gt; Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies how the virtual machines in the scale set + /// should be created.&lt;br&gt;&lt;br&gt; The only + /// allowed value is: **FromImage** \u2013 This value is used when you + /// are using an image to create the virtual machine. If you are using + /// a platform image, you also use the imageReference element described + /// above. If you are using a marketplace image, you also use the plan + /// element previously described. Possible values include: 'FromImage', + /// 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the ephemeral disk Settings for the + /// operating system disk used by the virtual machine scale set. + /// + [JsonProperty(PropertyName = "diffDiskSettings")] + public DiffDiskSettings DiffDiskSettings { get; set; } + + /// + /// Gets or sets specifies the size of the operating system disk in + /// gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. + /// &lt;br&gt;&lt;br&gt; This value cannot be larger + /// than 1023 GB + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk if creating a VM from user-image or a + /// specialized VHD. &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 = "osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets specifies information about the unmanaged user image + /// to base the scale set on. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets specifies the container urls that are used to store + /// operating system disks for the scale set. + /// + [JsonProperty(PropertyName = "vhdContainers")] + public IList VhdContainers { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.cs new file mode 100644 index 0000000000000..91d51409fb8ed --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.cs @@ -0,0 +1,208 @@ +// +// 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 virtual machine scale set OS profile. + /// + public partial class VirtualMachineScaleSetOSProfile + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSProfile + /// class. + /// + public VirtualMachineScaleSetOSProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSProfile + /// class. + /// + /// Specifies the computer name prefix + /// for all of the virtual machines in the scale set. Computer name + /// prefixes must be 1 to 15 characters long. + /// Specifies the name of the administrator + /// account. <br><br> **Windows-only restriction:** Cannot + /// end in "." <br><br> **Disallowed values:** + /// "administrator", "admin", "user", "user1", "test", "user2", + /// "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", + /// "admin2", "aspnet", "backup", "console", "david", "guest", "john", + /// "owner", "root", "server", "sql", "support", "support_388945a0", + /// "sys", "test2", "test3", "user4", "user5". <br><br> + /// **Minimum-length (Linux):** 1 character <br><br> + /// **Max-length (Linux):** 64 characters <br><br> + /// **Max-length (Windows):** 20 characters + /// <br><br><li> For root access to the Linux VM, see + /// [Using root privileges on Linux virtual machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)<br><li> + /// For a list of built-in system users on Linux that should not be + /// used in this field, see [Selecting User Names for Linux on + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// Specifies the password of the + /// administrator account. <br><br> **Minimum-length + /// (Windows):** 8 characters <br><br> **Minimum-length + /// (Linux):** 6 characters <br><br> **Max-length + /// (Windows):** 123 characters <br><br> **Max-length + /// (Linux):** 72 characters <br><br> **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// <br> Has lower characters <br>Has upper characters + /// <br> Has a digit <br> Has a special character (Regex + /// match [\W_]) <br><br> **Disallowed values:** "abc@123", + /// "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", + /// "Password!", "Password1", "Password22", "iloveyou!" + /// <br><br> For resetting the password, see [How to reset + /// the Remote Desktop service or its login password in a Windows + /// VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// <br><br> For resetting root password, see [Manage + /// users, SSH, and check or repair disks on Azure Linux VMs using the + /// VMAccess + /// Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + /// Specifies a base-64 encoded string of + /// custom data. The base-64 encoded string is decoded to a binary + /// array that is saved as a file on the Virtual Machine. The maximum + /// length of the binary array is 65535 bytes. <br><br> For + /// using cloud-init for your VM, see [Using cloud-init to customize a + /// Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// Specifies Windows operating + /// system settings on the virtual machine. + /// Specifies the Linux operating + /// system settings on the virtual machine. <br><br>For a + /// list of supported Linux distributions, see [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// <br><br> For running non-endorsed distributions, see + /// [Information for Non-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + /// Specifies set of certificates that should be + /// installed onto the virtual machines in the scale set. + public VirtualMachineScaleSetOSProfile(string computerNamePrefix = default(string), string adminUsername = default(string), string adminPassword = default(string), string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList)) + { + ComputerNamePrefix = computerNamePrefix; + AdminUsername = adminUsername; + AdminPassword = adminPassword; + CustomData = customData; + WindowsConfiguration = windowsConfiguration; + LinuxConfiguration = linuxConfiguration; + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the computer name prefix for all of the + /// virtual machines in the scale set. Computer name prefixes must be 1 + /// to 15 characters long. + /// + [JsonProperty(PropertyName = "computerNamePrefix")] + public string ComputerNamePrefix { get; set; } + + /// + /// Gets or sets specifies the name of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Windows-only restriction:** + /// Cannot end in "." &lt;br&gt;&lt;br&gt; **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Linux):** 1 + /// character &lt;br&gt;&lt;br&gt; **Max-length + /// (Linux):** 64 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 20 characters + /// &lt;br&gt;&lt;br&gt;&lt;li&gt; For root + /// access to the Linux VM, see [Using root privileges on Linux virtual + /// machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)&lt;br&gt;&lt;li&gt; + /// For a list of built-in system users on Linux that should not be + /// used in this field, see [Selecting User Names for Linux on + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; set; } + + /// + /// Gets or sets specifies the password of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Windows):** + /// 8 characters &lt;br&gt;&lt;br&gt; **Minimum-length + /// (Linux):** 6 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 123 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 72 + /// characters &lt;br&gt;&lt;br&gt; **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// &lt;br&gt; Has lower characters &lt;br&gt;Has upper + /// characters &lt;br&gt; Has a digit &lt;br&gt; Has a + /// special character (Regex match [\W_]) + /// &lt;br&gt;&lt;br&gt; **Disallowed values:** + /// "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + /// "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + /// &lt;br&gt;&lt;br&gt; For resetting the password, + /// see [How to reset the Remote Desktop service or its login password + /// in a Windows + /// VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; For resetting root password, + /// see [Manage users, SSH, and check or repair disks on Azure Linux + /// VMs using the VMAccess + /// Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + /// + [JsonProperty(PropertyName = "adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Gets or sets specifies a base-64 encoded string of custom data. The + /// base-64 encoded string is decoded to a binary array that is saved + /// as a file on the Virtual Machine. The maximum length of the binary + /// array is 65535 bytes. &lt;br&gt;&lt;br&gt; For + /// using cloud-init for your VM, see [Using cloud-init to customize a + /// Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// + [JsonProperty(PropertyName = "customData")] + public string CustomData { get; set; } + + /// + /// Gets or sets specifies Windows operating system settings on the + /// virtual machine. + /// + [JsonProperty(PropertyName = "windowsConfiguration")] + public WindowsConfiguration WindowsConfiguration { get; set; } + + /// + /// Gets or sets specifies the Linux operating system settings on the + /// virtual machine. &lt;br&gt;&lt;br&gt;For a list of + /// supported Linux distributions, see [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; For running non-endorsed + /// distributions, see [Information for Non-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + /// + [JsonProperty(PropertyName = "linuxConfiguration")] + public LinuxConfiguration LinuxConfiguration { get; set; } + + /// + /// Gets or sets specifies set of certificates that should be installed + /// onto the virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs new file mode 100644 index 0000000000000..c587d070e649d --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs @@ -0,0 +1,130 @@ +// +// 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; + + /// + /// Describes a virtual machines scale set IP Configuration's + /// PublicIPAddress configuration + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetPublicIPAddressConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfiguration class. + /// + public VirtualMachineScaleSetPublicIPAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfiguration class. + /// + /// The publicIP address configuration name. + /// The idle timeout of the public + /// IP address. + /// The dns settings to be applied on the + /// publicIP addresses . + /// The list of IP tags associated with the public + /// IP address. + /// The PublicIPPrefix from which to + /// allocate publicIP addresses. + /// Available from Api-Version + /// 2019-07-01 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + /// values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', + /// 'IPv6' + public VirtualMachineScaleSetPublicIPAddressConfiguration(string name, int? idleTimeoutInMinutes = default(int?), VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings), IList ipTags = default(IList), SubResource publicIPPrefix = default(SubResource), string publicIPAddressVersion = default(string)) + { + Name = name; + IdleTimeoutInMinutes = idleTimeoutInMinutes; + DnsSettings = dnsSettings; + IpTags = ipTags; + PublicIPPrefix = publicIPPrefix; + PublicIPAddressVersion = publicIPAddressVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the publicIP address configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the idle timeout of the public IP address. + /// + [JsonProperty(PropertyName = "properties.idleTimeoutInMinutes")] + public int? IdleTimeoutInMinutes { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the publicIP + /// addresses . + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Gets or sets the list of IP tags associated with the public IP + /// address. + /// + [JsonProperty(PropertyName = "properties.ipTags")] + public IList IpTags { get; set; } + + /// + /// Gets or sets the PublicIPPrefix from which to allocate publicIP + /// addresses. + /// + [JsonProperty(PropertyName = "properties.publicIPPrefix")] + public SubResource PublicIPPrefix { get; set; } + + /// + /// Gets or sets available from Api-Version 2019-07-01 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.publicIPAddressVersion")] + public string PublicIPAddressVersion { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (DnsSettings != null) + { + DnsSettings.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs new file mode 100644 index 0000000000000..6bc341504dfd9 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs @@ -0,0 +1,75 @@ +// +// 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; + + /// + /// Describes a virtual machines scale sets network configuration's DNS + /// settings. + /// + public partial class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + /// class. + /// + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + /// class. + /// + /// The Domain name label.The + /// concatenation of the domain name label and vm index will be the + /// domain name labels of the PublicIPAddress resources that will be + /// created + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(string domainNameLabel) + { + DomainNameLabel = domainNameLabel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Domain name label.The concatenation of the domain + /// name label and vm index will be the domain name labels of the + /// PublicIPAddress resources that will be created + /// + [JsonProperty(PropertyName = "domainNameLabel")] + public string DomainNameLabel { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainNameLabel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainNameLabel"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetReimageParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetReimageParameters.cs new file mode 100644 index 0000000000000..7aec9d687117c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetReimageParameters.cs @@ -0,0 +1,65 @@ +// +// 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 Virtual Machine Scale Set VM Reimage Parameters. + /// + public partial class VirtualMachineScaleSetReimageParameters : VirtualMachineScaleSetVMReimageParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetReimageParameters class. + /// + public VirtualMachineScaleSetReimageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetReimageParameters class. + /// + /// Specifies whether to reimage temp disk. + /// Default value: false. Note: This temp disk reimage parameter is + /// only supported for VM/VMSS with Ephemeral OS disk. + /// The virtual machine scale set instance + /// ids. Omitting the virtual machine scale set instance ids will + /// result in the operation being performed on all virtual machines in + /// the virtual machine scale set. + public VirtualMachineScaleSetReimageParameters(bool? tempDisk = default(bool?), IList instanceIds = default(IList)) + : base(tempDisk) + { + InstanceIds = instanceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set instance ids. Omitting + /// the virtual machine scale set instance ids will result in the + /// operation being performed on all virtual machines in the virtual + /// machine scale set. + /// + [JsonProperty(PropertyName = "instanceIds")] + public IList InstanceIds { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs new file mode 100644 index 0000000000000..bbe4bf22bc332 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.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 VirtualMachineScaleSetScaleInRules. + /// + public static class VirtualMachineScaleSetScaleInRules + { + public const string Default = "Default"; + public const string OldestVM = "OldestVM"; + public const string NewestVM = "NewestVM"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSku.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSku.cs new file mode 100644 index 0000000000000..8aa58b7d84742 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSku.cs @@ -0,0 +1,69 @@ +// +// 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 an available virtual machine scale set sku. + /// + public partial class VirtualMachineScaleSetSku + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetSku class. + /// + public VirtualMachineScaleSetSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetSku class. + /// + /// The type of resource the sku applies + /// to. + /// The Sku. + /// Specifies the number of virtual machines in + /// the scale set. + public VirtualMachineScaleSetSku(string resourceType = default(string), Sku sku = default(Sku), VirtualMachineScaleSetSkuCapacity capacity = default(VirtualMachineScaleSetSkuCapacity)) + { + ResourceType = resourceType; + Sku = sku; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of resource the sku applies to. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets the Sku. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; private set; } + + /// + /// Gets specifies the number of virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "capacity")] + public VirtualMachineScaleSetSkuCapacity Capacity { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs new file mode 100644 index 0000000000000..769672d81222e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs @@ -0,0 +1,79 @@ +// +// 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 scaling information of a sku. + /// + public partial class VirtualMachineScaleSetSkuCapacity + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetSkuCapacity + /// class. + /// + public VirtualMachineScaleSetSkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetSkuCapacity + /// class. + /// + /// The minimum capacity. + /// The maximum capacity that can be set. + /// The default capacity. + /// The scale type applicable to the sku. + /// Possible values include: 'Automatic', 'None' + public VirtualMachineScaleSetSkuCapacity(long? minimum = default(long?), long? maximum = default(long?), long? defaultCapacity = default(long?), VirtualMachineScaleSetSkuScaleType? scaleType = default(VirtualMachineScaleSetSkuScaleType?)) + { + Minimum = minimum; + Maximum = maximum; + DefaultCapacity = defaultCapacity; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the minimum capacity. + /// + [JsonProperty(PropertyName = "minimum")] + public long? Minimum { get; private set; } + + /// + /// Gets the maximum capacity that can be set. + /// + [JsonProperty(PropertyName = "maximum")] + public long? Maximum { get; private set; } + + /// + /// Gets the default capacity. + /// + [JsonProperty(PropertyName = "defaultCapacity")] + public long? DefaultCapacity { get; private set; } + + /// + /// Gets the scale type applicable to the sku. Possible values include: + /// 'Automatic', 'None' + /// + [JsonProperty(PropertyName = "scaleType")] + public VirtualMachineScaleSetSkuScaleType? ScaleType { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSkuScaleType.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSkuScaleType.cs new file mode 100644 index 0000000000000..37eb1dcb7da74 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetSkuScaleType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for VirtualMachineScaleSetSkuScaleType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum VirtualMachineScaleSetSkuScaleType + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "None")] + None + } + internal static class VirtualMachineScaleSetSkuScaleTypeEnumExtension + { + internal static string ToSerializedValue(this VirtualMachineScaleSetSkuScaleType? value) + { + return value == null ? null : ((VirtualMachineScaleSetSkuScaleType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this VirtualMachineScaleSetSkuScaleType value) + { + switch( value ) + { + case VirtualMachineScaleSetSkuScaleType.Automatic: + return "Automatic"; + case VirtualMachineScaleSetSkuScaleType.None: + return "None"; + } + return null; + } + + internal static VirtualMachineScaleSetSkuScaleType? ParseVirtualMachineScaleSetSkuScaleType(this string value) + { + switch( value ) + { + case "Automatic": + return VirtualMachineScaleSetSkuScaleType.Automatic; + case "None": + return VirtualMachineScaleSetSkuScaleType.None; + } + return null; + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.cs new file mode 100644 index 0000000000000..4907b35c39742 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.cs @@ -0,0 +1,119 @@ +// +// 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 virtual machine scale set storage profile. + /// + public partial class VirtualMachineScaleSetStorageProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetStorageProfile class. + /// + public VirtualMachineScaleSetStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetStorageProfile class. + /// + /// Specifies information about the image + /// to use. You can specify information about platform images, + /// marketplace images, or virtual machine images. This element is + /// required when you want to use a platform image, marketplace image, + /// or virtual machine image, but is not used in other creation + /// operations. + /// Specifies information about the operating + /// system disk used by the virtual machines in the scale set. + /// <br><br> For more information about disks, see [About + /// disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// Specifies the parameters that are used to + /// add data disks to the virtual machines in the scale set. + /// <br><br> For more information about disks, see [About + /// disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + public VirtualMachineScaleSetStorageProfile(ImageReference imageReference = default(ImageReference), VirtualMachineScaleSetOSDisk osDisk = default(VirtualMachineScaleSetOSDisk), IList dataDisks = default(IList)) + { + ImageReference = imageReference; + OsDisk = osDisk; + DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies information about the image to use. You can + /// specify information about platform images, marketplace images, or + /// virtual machine images. This element is required when you want to + /// use a platform image, marketplace image, or virtual machine image, + /// but is not used in other creation operations. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets or sets specifies information about the operating system disk + /// used by the virtual machines in the scale set. + /// &lt;br&gt;&lt;br&gt; For more information about + /// disks, see [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// + [JsonProperty(PropertyName = "osDisk")] + public VirtualMachineScaleSetOSDisk OsDisk { get; set; } + + /// + /// Gets or sets specifies the parameters that are used to add data + /// disks to the virtual machines in the scale set. + /// &lt;br&gt;&lt;br&gt; For more information about + /// disks, see [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsDisk != null) + { + OsDisk.Validate(); + } + if (DataDisks != null) + { + foreach (var element in DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs new file mode 100644 index 0000000000000..c03a3715a3772 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs @@ -0,0 +1,201 @@ +// +// 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; + + /// + /// Describes a Virtual Machine Scale Set. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdate : UpdateResource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetUpdate + /// class. + /// + public VirtualMachineScaleSetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetUpdate + /// class. + /// + /// Resource tags + /// The virtual machine scale set sku. + /// The purchase plan when deploying a virtual + /// machine scale set from VM Marketplace images. + /// The upgrade policy. + /// Policy for automatic + /// repairs. + /// The virtual machine + /// profile. + /// Specifies whether the Virtual Machine + /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. + /// When true this limits the scale + /// set to a single placement group, of max size 100 virtual machines. + /// NOTE: If singlePlacementGroup is true, it may be modified to false. + /// However, if singlePlacementGroup is false, it may not be modified + /// to true. + /// Specifies additional + /// capabilities enabled or disabled on the Virtual Machines in the + /// Virtual Machine Scale Set. For instance: whether the Virtual + /// Machines have the capability to support attaching managed data + /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. + /// Specifies information about + /// the proximity placement group that the virtual machine scale set + /// should be assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// The identity of the virtual machine scale + /// set, if configured. + public VirtualMachineScaleSetUpdate(IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile = default(VirtualMachineScaleSetUpdateVMProfile), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), bool? singlePlacementGroup = default(bool?), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), SubResource proximityPlacementGroup = default(SubResource), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity)) + : base(tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + SinglePlacementGroup = singlePlacementGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + ProximityPlacementGroup = proximityPlacementGroup; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set sku. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets the purchase plan when deploying a virtual machine + /// scale set from VM Marketplace images. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets the upgrade policy. + /// + [JsonProperty(PropertyName = "properties.upgradePolicy")] + public UpgradePolicy UpgradePolicy { get; set; } + + /// + /// Gets or sets policy for automatic repairs. + /// + [JsonProperty(PropertyName = "properties.automaticRepairsPolicy")] + public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; } + + /// + /// Gets or sets the virtual machine profile. + /// + [JsonProperty(PropertyName = "properties.virtualMachineProfile")] + public VirtualMachineScaleSetUpdateVMProfile VirtualMachineProfile { get; set; } + + /// + /// Gets or sets specifies whether the Virtual Machine Scale Set should + /// be overprovisioned. + /// + [JsonProperty(PropertyName = "properties.overprovision")] + public bool? Overprovision { get; set; } + + /// + /// Gets or sets when Overprovision is enabled, extensions are launched + /// only on the requested number of VMs which are finally kept. This + /// property will hence ensure that the extensions do not run on the + /// extra overprovisioned VMs. + /// + [JsonProperty(PropertyName = "properties.doNotRunExtensionsOnOverprovisionedVMs")] + public bool? DoNotRunExtensionsOnOverprovisionedVMs { get; set; } + + /// + /// Gets or sets when true this limits the scale set to a single + /// placement group, of max size 100 virtual machines. NOTE: If + /// singlePlacementGroup is true, it may be modified to false. However, + /// if singlePlacementGroup is false, it may not be modified to true. + /// + [JsonProperty(PropertyName = "properties.singlePlacementGroup")] + public bool? SinglePlacementGroup { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the Virtual Machines in the Virtual Machine Scale Set. For + /// instance: whether the Virtual Machines have the capability to + /// support attaching managed data disks with UltraSSD_LRS storage + /// account type. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the scale-in policy that decides which + /// virtual machines are chosen for removal when a Virtual Machine + /// Scale Set is scaled-in. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine scale set should be assigned to. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets the identity of the virtual machine scale set, if + /// configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineScaleSetIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UpgradePolicy != null) + { + UpgradePolicy.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs new file mode 100644 index 0000000000000..05a7a7829ec53 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs @@ -0,0 +1,156 @@ +// +// 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; + + /// + /// Describes a virtual machine scale set network profile's IP + /// configuration. NOTE: The subnet of a scale set may be modified as long + /// as the original subnet and the new subnet are in the same virtual + /// network + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdateIPConfiguration : SubResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateIPConfiguration class. + /// + public VirtualMachineScaleSetUpdateIPConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateIPConfiguration class. + /// + /// Resource Id + /// The IP configuration name. + /// The subnet. + /// Specifies the primary IP Configuration in + /// case the network interface has more than one IP + /// Configuration. + /// The + /// publicIPAddressConfiguration. + /// Available from Api-Version + /// 2017-03-30 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + /// Possible values are: 'IPv4' and 'IPv6'. Possible values include: + /// 'IPv4', 'IPv6' + /// The application + /// gateway backend address pools. + /// Specifies an array of + /// references to application security group. + /// The load balancer + /// backend address pools. + /// The load balancer inbound + /// nat pools. + public VirtualMachineScaleSetUpdateIPConfiguration(string id = default(string), string name = default(string), ApiEntityReference subnet = default(ApiEntityReference), bool? primary = default(bool?), VirtualMachineScaleSetUpdatePublicIPAddressConfiguration publicIPAddressConfiguration = default(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration), string privateIPAddressVersion = default(string), IList applicationGatewayBackendAddressPools = default(IList), IList applicationSecurityGroups = default(IList), IList loadBalancerBackendAddressPools = default(IList), IList loadBalancerInboundNatPools = default(IList)) + : base(id) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + ApplicationSecurityGroups = applicationSecurityGroups; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + LoadBalancerInboundNatPools = loadBalancerInboundNatPools; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the IP configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public ApiEntityReference Subnet { get; set; } + + /// + /// Gets or sets specifies the primary IP Configuration in case the + /// network interface has more than one IP Configuration. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets the publicIPAddressConfiguration. + /// + [JsonProperty(PropertyName = "properties.publicIPAddressConfiguration")] + public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration PublicIPAddressConfiguration { get; set; } + + /// + /// Gets or sets available from Api-Version 2017-03-30 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.privateIPAddressVersion")] + public string PrivateIPAddressVersion { get; set; } + + /// + /// Gets or sets the application gateway backend address pools. + /// + [JsonProperty(PropertyName = "properties.applicationGatewayBackendAddressPools")] + public IList ApplicationGatewayBackendAddressPools { get; set; } + + /// + /// Gets or sets specifies an array of references to application + /// security group. + /// + [JsonProperty(PropertyName = "properties.applicationSecurityGroups")] + public IList ApplicationSecurityGroups { get; set; } + + /// + /// Gets or sets the load balancer backend address pools. + /// + [JsonProperty(PropertyName = "properties.loadBalancerBackendAddressPools")] + public IList LoadBalancerBackendAddressPools { get; set; } + + /// + /// Gets or sets the load balancer inbound nat pools. + /// + [JsonProperty(PropertyName = "properties.loadBalancerInboundNatPools")] + public IList LoadBalancerInboundNatPools { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PublicIPAddressConfiguration != null) + { + PublicIPAddressConfiguration.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs new file mode 100644 index 0000000000000..3e66fccf71790 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile's network + /// configurations. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : SubResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkConfiguration class. + /// + public VirtualMachineScaleSetUpdateNetworkConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkConfiguration class. + /// + /// Resource Id + /// The network configuration name. + /// Whether this is a primary NIC on a virtual + /// machine. + /// Specifies whether the + /// network interface is accelerated networking-enabled. + /// The network security + /// group. + /// The dns settings to be applied on the + /// network interfaces. + /// The virtual machine scale set IP + /// Configuration. + /// Whether IP forwarding enabled on + /// this NIC. + public VirtualMachineScaleSetUpdateNetworkConfiguration(string id = default(string), string name = default(string), bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), IList ipConfigurations = default(IList), bool? enableIPForwarding = default(bool?)) + : base(id) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the network configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets whether this is a primary NIC on a virtual machine. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets specifies whether the network interface is accelerated + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableAcceleratedNetworking")] + public bool? EnableAcceleratedNetworking { get; set; } + + /// + /// Gets or sets the network security group. + /// + [JsonProperty(PropertyName = "properties.networkSecurityGroup")] + public SubResource NetworkSecurityGroup { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the network + /// interfaces. + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetNetworkConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Gets or sets the virtual machine scale set IP Configuration. + /// + [JsonProperty(PropertyName = "properties.ipConfigurations")] + public IList IpConfigurations { get; set; } + + /// + /// Gets or sets whether IP forwarding enabled on this NIC. + /// + [JsonProperty(PropertyName = "properties.enableIPForwarding")] + public bool? EnableIPForwarding { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs new file mode 100644 index 0000000000000..55396baa7bcd2 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile. + /// + public partial class VirtualMachineScaleSetUpdateNetworkProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkProfile class. + /// + public VirtualMachineScaleSetUpdateNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkProfile class. + /// + /// A reference to a load balancer probe used + /// to determine the health of an instance in the virtual machine scale + /// set. The reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// The list of network + /// configurations. + public VirtualMachineScaleSetUpdateNetworkProfile(ApiEntityReference healthProbe = default(ApiEntityReference), IList networkInterfaceConfigurations = default(IList)) + { + HealthProbe = healthProbe; + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a reference to a load balancer probe used to determine + /// the health of an instance in the virtual machine scale set. The + /// reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// + [JsonProperty(PropertyName = "healthProbe")] + public ApiEntityReference HealthProbe { get; set; } + + /// + /// Gets or sets the list of network configurations. + /// + [JsonProperty(PropertyName = "networkInterfaceConfigurations")] + public IList NetworkInterfaceConfigurations { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs new file mode 100644 index 0000000000000..cefdba0d15439 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs @@ -0,0 +1,114 @@ +// +// 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 virtual machine scale set operating system disk Update + /// Object. This should be used for Updating VMSS OS Disk. + /// + public partial class VirtualMachineScaleSetUpdateOSDisk + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSDisk class. + /// + public VirtualMachineScaleSetUpdateOSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSDisk class. + /// + /// The caching type. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the size of the operating system + /// disk in gigabytes. This element can be used to overwrite the size + /// of the disk in a virtual machine image. <br><br> This + /// value cannot be larger than 1023 GB + /// The Source User Image VirtualHardDisk. This + /// VirtualHardDisk will be copied before using it to attach to the + /// Virtual Machine. If SourceImage is provided, the destination + /// VirtualHardDisk should not exist. + /// The list of virtual hard disk container + /// uris. + /// The managed disk parameters. + public VirtualMachineScaleSetUpdateOSDisk(CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), VirtualHardDisk image = default(VirtualHardDisk), IList vhdContainers = default(IList), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters)) + { + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + DiskSizeGB = diskSizeGB; + Image = image; + VhdContainers = vhdContainers; + ManagedDisk = managedDisk; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the caching type. Possible values include: 'None', + /// 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies the size of the operating system disk in + /// gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. + /// &lt;br&gt;&lt;br&gt; This value cannot be larger + /// than 1023 GB + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the Source User Image VirtualHardDisk. This + /// VirtualHardDisk will be copied before using it to attach to the + /// Virtual Machine. If SourceImage is provided, the destination + /// VirtualHardDisk should not exist. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets the list of virtual hard disk container uris. + /// + [JsonProperty(PropertyName = "vhdContainers")] + public IList VhdContainers { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs new file mode 100644 index 0000000000000..48d6b2034fef1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.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; + + /// + /// Describes a virtual machine scale set OS profile. + /// + public partial class VirtualMachineScaleSetUpdateOSProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSProfile class. + /// + public VirtualMachineScaleSetUpdateOSProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSProfile class. + /// + /// A base-64 encoded string of custom + /// data. + /// The Windows Configuration of the + /// OS profile. + /// The Linux Configuration of the OS + /// profile. + /// The List of certificates for addition to the + /// VM. + public VirtualMachineScaleSetUpdateOSProfile(string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList)) + { + CustomData = customData; + WindowsConfiguration = windowsConfiguration; + LinuxConfiguration = linuxConfiguration; + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a base-64 encoded string of custom data. + /// + [JsonProperty(PropertyName = "customData")] + public string CustomData { get; set; } + + /// + /// Gets or sets the Windows Configuration of the OS profile. + /// + [JsonProperty(PropertyName = "windowsConfiguration")] + public WindowsConfiguration WindowsConfiguration { get; set; } + + /// + /// Gets or sets the Linux Configuration of the OS profile. + /// + [JsonProperty(PropertyName = "linuxConfiguration")] + public LinuxConfiguration LinuxConfiguration { get; set; } + + /// + /// Gets or sets the List of certificates for addition to the VM. + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs new file mode 100644 index 0000000000000..8bb0b43d722ff --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs @@ -0,0 +1,89 @@ +// +// 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 virtual machines scale set IP Configuration's + /// PublicIPAddress configuration + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdatePublicIPAddressConfiguration class. + /// + public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdatePublicIPAddressConfiguration class. + /// + /// The publicIP address configuration name. + /// The idle timeout of the public + /// IP address. + /// The dns settings to be applied on the + /// publicIP addresses . + public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(string name = default(string), int? idleTimeoutInMinutes = default(int?), VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings)) + { + Name = name; + IdleTimeoutInMinutes = idleTimeoutInMinutes; + DnsSettings = dnsSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the publicIP address configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the idle timeout of the public IP address. + /// + [JsonProperty(PropertyName = "properties.idleTimeoutInMinutes")] + public int? IdleTimeoutInMinutes { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the publicIP + /// addresses . + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DnsSettings != null) + { + DnsSettings.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs new file mode 100644 index 0000000000000..c32d53b9316b5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.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; + + /// + /// Describes a virtual machine scale set storage profile. + /// + public partial class VirtualMachineScaleSetUpdateStorageProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateStorageProfile class. + /// + public VirtualMachineScaleSetUpdateStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateStorageProfile class. + /// + /// The image reference. + /// The OS disk. + /// The data disks. + public VirtualMachineScaleSetUpdateStorageProfile(ImageReference imageReference = default(ImageReference), VirtualMachineScaleSetUpdateOSDisk osDisk = default(VirtualMachineScaleSetUpdateOSDisk), IList dataDisks = default(IList)) + { + ImageReference = imageReference; + OsDisk = osDisk; + DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the image reference. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets or sets the OS disk. + /// + [JsonProperty(PropertyName = "osDisk")] + public VirtualMachineScaleSetUpdateOSDisk OsDisk { get; set; } + + /// + /// Gets or sets the data disks. + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs new file mode 100644 index 0000000000000..681057f69d5ab --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs @@ -0,0 +1,140 @@ +// +// 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 virtual machine scale set virtual machine profile. + /// + public partial class VirtualMachineScaleSetUpdateVMProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateVMProfile class. + /// + public VirtualMachineScaleSetUpdateVMProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateVMProfile class. + /// + /// The virtual machine scale set OS + /// profile. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS + /// The virtual machine scale set storage + /// profile. + /// The virtual machine scale set network + /// profile. + /// The virtual machine scale set + /// Security profile + /// The virtual machine scale set + /// diagnostics profile. + /// The virtual machine scale set + /// extension profile. + /// The license type, which is for bring your + /// own license scenario. + /// Specifies the billing related details + /// of a Azure Spot VMSS. <br><br>Minimum api-version: + /// 2019-03-01. + /// Specifies Scheduled Event + /// related configurations. + public VirtualMachineScaleSetUpdateVMProfile(VirtualMachineScaleSetUpdateOSProfile osProfile = default(VirtualMachineScaleSetUpdateOSProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), VirtualMachineScaleSetUpdateStorageProfile storageProfile = default(VirtualMachineScaleSetUpdateStorageProfile), VirtualMachineScaleSetUpdateNetworkProfile networkProfile = default(VirtualMachineScaleSetUpdateNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile)) + { + OsProfile = osProfile; + ApplicationProfile = applicationProfile; + StorageProfile = storageProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + ExtensionProfile = extensionProfile; + LicenseType = licenseType; + BillingProfile = billingProfile; + ScheduledEventsProfile = scheduledEventsProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set OS profile. + /// + [JsonProperty(PropertyName = "osProfile")] + public VirtualMachineScaleSetUpdateOSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set storage profile. + /// + [JsonProperty(PropertyName = "storageProfile")] + public VirtualMachineScaleSetUpdateStorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set network profile. + /// + [JsonProperty(PropertyName = "networkProfile")] + public VirtualMachineScaleSetUpdateNetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set Security profile + /// + [JsonProperty(PropertyName = "securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set diagnostics profile. + /// + [JsonProperty(PropertyName = "diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set extension profile. + /// + [JsonProperty(PropertyName = "extensionProfile")] + public VirtualMachineScaleSetExtensionProfile ExtensionProfile { get; set; } + + /// + /// Gets or sets the license type, which is for bring your own license + /// scenario. + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// VMSS. &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2019-03-01. + /// + [JsonProperty(PropertyName = "billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies Scheduled Event related configurations. + /// + [JsonProperty(PropertyName = "scheduledEventsProfile")] + public ScheduledEventsProfile ScheduledEventsProfile { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVM.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVM.cs new file mode 100644 index 0000000000000..4d64ba5ad5819 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVM.cs @@ -0,0 +1,348 @@ +// +// 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; + + /// + /// Describes a virtual machine scale set virtual machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetVM : Resource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVM class. + /// + public VirtualMachineScaleSetVM() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetVM class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine instance ID. + /// The virtual machine SKU. + /// Specifies whether the latest model + /// has been applied to the virtual machine. + /// Azure VM unique ID. + /// The virtual machine instance + /// view. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine in the + /// scale set. For instance: whether the virtual machine has the + /// capability to support attaching managed data disks with + /// UltraSSD_LRS storage account type. + /// Specifies the operating system settings for + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the network + /// profile configuration of the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// Specifies information about the + /// availability set that the virtual machine should be assigned to. + /// Virtual machines specified in the same availability set are + /// allocated to different nodes to maximize availability. For more + /// information about availability sets, see [Manage the availability + /// of virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// <br><br> For more information on Azure planned + /// maintenance, see [Planned maintenance for virtual machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. An existing VM cannot be added + /// to an availability set. + /// 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) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies whether the model + /// applied to the virtual machine is the model of the virtual machine + /// scale set or the customized model for the virtual machine. + /// Specifies the protection policy of + /// the virtual machine. + /// Specifies information about the marketplace + /// image used to create the virtual machine. This element is only used + /// for marketplace images. Before you can use a marketplace image from + /// an API, you must enable the image for programmatic use. In the + /// Azure portal, find the marketplace image that you want to use and + /// then click **Want to deploy programmatically, Get Started ->**. + /// Enter any required information and then click **Save**. + /// The virtual machine child extension + /// resources. + /// The virtual machine zones. + public VirtualMachineScaleSetVM(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string instanceId = default(string), Sku sku = default(Sku), bool? latestModelApplied = default(bool?), string vmId = default(string), VirtualMachineScaleSetVMInstanceView instanceView = default(VirtualMachineScaleSetVMInstanceView), HardwareProfile hardwareProfile = default(HardwareProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), SecurityProfile securityProfile = default(SecurityProfile), NetworkProfile networkProfile = default(NetworkProfile), VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration = default(VirtualMachineScaleSetVMNetworkProfileConfiguration), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), string provisioningState = default(string), string licenseType = default(string), string modelDefinitionApplied = default(string), VirtualMachineScaleSetVMProtectionPolicy protectionPolicy = default(VirtualMachineScaleSetVMProtectionPolicy), Plan plan = default(Plan), IList resources = default(IList), IList zones = default(IList)) + : base(location, id, name, type, tags) + { + InstanceId = instanceId; + Sku = sku; + LatestModelApplied = latestModelApplied; + VmId = vmId; + InstanceView = instanceView; + HardwareProfile = hardwareProfile; + ApplicationProfile = applicationProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + SecurityProfile = securityProfile; + NetworkProfile = networkProfile; + NetworkProfileConfiguration = networkProfileConfiguration; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + ProvisioningState = provisioningState; + LicenseType = licenseType; + ModelDefinitionApplied = modelDefinitionApplied; + ProtectionPolicy = protectionPolicy; + Plan = plan; + Resources = resources; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the virtual machine instance ID. + /// + [JsonProperty(PropertyName = "instanceId")] + public string InstanceId { get; private set; } + + /// + /// Gets the virtual machine SKU. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; private set; } + + /// + /// Gets specifies whether the latest model has been applied to the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.latestModelApplied")] + public bool? LatestModelApplied { get; private set; } + + /// + /// Gets azure VM unique ID. + /// + [JsonProperty(PropertyName = "properties.vmId")] + public string VmId { get; private set; } + + /// + /// Gets the virtual machine instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineScaleSetVMInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets specifies the hardware settings for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.hardwareProfile")] + public HardwareProfile HardwareProfile { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the virtual machine in the scale set. For instance: whether the + /// virtual machine has the capability to support attaching managed + /// data disks with UltraSSD_LRS storage account type. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the operating system settings for the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.osProfile")] + public OSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machine. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the network interfaces of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the network profile configuration of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.networkProfileConfiguration")] + public VirtualMachineScaleSetVMNetworkProfileConfiguration NetworkProfileConfiguration { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2015-06-15. + /// + [JsonProperty(PropertyName = "properties.diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets specifies information about the availability set that + /// the virtual machine should be assigned to. Virtual machines + /// specified in the same availability set are allocated to different + /// nodes to maximize availability. For more information about + /// availability sets, see [Manage the availability of virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// &lt;br&gt;&lt;br&gt; For more information on Azure + /// planned maintenance, see [Planned maintenance for virtual machines + /// in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; Currently, a VM can only be + /// added to availability set at creation time. An existing VM cannot + /// be added to an availability set. + /// + [JsonProperty(PropertyName = "properties.availabilitySet")] + public SubResource AvailabilitySet { 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 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: + /// &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; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets specifies whether the model applied to the virtual machine is + /// the model of the virtual machine scale set or the customized model + /// for the virtual machine. + /// + [JsonProperty(PropertyName = "properties.modelDefinitionApplied")] + public string ModelDefinitionApplied { get; private set; } + + /// + /// Gets or sets specifies the protection policy of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.protectionPolicy")] + public VirtualMachineScaleSetVMProtectionPolicy ProtectionPolicy { get; set; } + + /// + /// Gets or sets specifies information about the marketplace image used + /// to create the virtual machine. This element is only used for + /// marketplace images. Before you can use a marketplace image from an + /// API, you must enable the image for programmatic use. In the Azure + /// portal, find the marketplace image that you want to use and then + /// click **Want to deploy programmatically, Get Started -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets the virtual machine child extension resources. + /// + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; private set; } + + /// + /// Gets the virtual machine zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + if (Resources != null) + { + foreach (var element in Resources) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionsSummary.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionsSummary.cs new file mode 100644 index 0000000000000..aabf14a4753cb --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionsSummary.cs @@ -0,0 +1,63 @@ +// +// 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; + + /// + /// Extensions summary for virtual machines of a virtual machine scale set. + /// + public partial class VirtualMachineScaleSetVMExtensionsSummary + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsSummary class. + /// + public VirtualMachineScaleSetVMExtensionsSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsSummary class. + /// + /// The extension name. + /// The extensions information. + public VirtualMachineScaleSetVMExtensionsSummary(string name = default(string), IList statusesSummary = default(IList)) + { + Name = name; + StatusesSummary = statusesSummary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the extension name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the extensions information. + /// + [JsonProperty(PropertyName = "statusesSummary")] + public IList StatusesSummary { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceIDs.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceIDs.cs new file mode 100644 index 0000000000000..b51892cd4f823 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceIDs.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; + + /// + /// Specifies a list of virtual machine instance IDs from the VM scale set. + /// + public partial class VirtualMachineScaleSetVMInstanceIDs + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceIDs class. + /// + public VirtualMachineScaleSetVMInstanceIDs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceIDs class. + /// + /// The virtual machine scale set instance + /// ids. Omitting the virtual machine scale set instance ids will + /// result in the operation being performed on all virtual machines in + /// the virtual machine scale set. + public VirtualMachineScaleSetVMInstanceIDs(IList instanceIds = default(IList)) + { + InstanceIds = instanceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set instance ids. Omitting + /// the virtual machine scale set instance ids will result in the + /// operation being performed on all virtual machines in the virtual + /// machine scale set. + /// + [JsonProperty(PropertyName = "instanceIds")] + public IList InstanceIds { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceRequiredIDs.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceRequiredIDs.cs new file mode 100644 index 0000000000000..061ad001a64e1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceRequiredIDs.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 virtual machine instance IDs from the VM scale set. + /// + public partial class VirtualMachineScaleSetVMInstanceRequiredIDs + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceRequiredIDs class. + /// + public VirtualMachineScaleSetVMInstanceRequiredIDs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceRequiredIDs class. + /// + /// The virtual machine scale set instance + /// ids. + public VirtualMachineScaleSetVMInstanceRequiredIDs(IList instanceIds) + { + InstanceIds = instanceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set instance ids. + /// + [JsonProperty(PropertyName = "instanceIds")] + public IList InstanceIds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (InstanceIds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "InstanceIds"); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceView.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceView.cs new file mode 100644 index 0000000000000..28cd705dc9f79 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMInstanceView.cs @@ -0,0 +1,167 @@ +// +// 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 a virtual machine scale set VM. + /// + public partial class VirtualMachineScaleSetVMInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceView class. + /// + public VirtualMachineScaleSetVMInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceView class. + /// + /// The Update Domain count. + /// The Fault Domain count. + /// The Remote desktop certificate + /// thumbprint. + /// The VM Agent running on the virtual + /// machine. + /// The Maintenance Operation + /// status on the virtual machine. + /// The disks information. + /// The extensions information. + /// The health status for the VM. + /// Boot Diagnostics is a debugging + /// feature which allows you to view Console Output and Screenshot to + /// diagnose VM status. <br><br> You can easily view the + /// output of your console log. <br><br> Azure also enables + /// you to see a screenshot of the VM from the hypervisor. + /// The resource status information. + /// Resource id of the dedicated host, on + /// which the virtual machine is allocated through automatic placement, + /// when the virtual machine is associated with a dedicated host group + /// that has automatic placement enabled. <br><br>Minimum + /// api-version: 2020-06-01. + /// The placement group in which the VM + /// is running. If the VM is deallocated it will not have a + /// placementGroupId. + public VirtualMachineScaleSetVMInstanceView(int? platformUpdateDomain = default(int?), int? platformFaultDomain = default(int?), string rdpThumbPrint = default(string), VirtualMachineAgentInstanceView vmAgent = default(VirtualMachineAgentInstanceView), MaintenanceRedeployStatus maintenanceRedeployStatus = default(MaintenanceRedeployStatus), IList disks = default(IList), IList extensions = default(IList), VirtualMachineHealthStatus vmHealth = default(VirtualMachineHealthStatus), BootDiagnosticsInstanceView bootDiagnostics = default(BootDiagnosticsInstanceView), IList statuses = default(IList), string assignedHost = default(string), string placementGroupId = default(string)) + { + PlatformUpdateDomain = platformUpdateDomain; + PlatformFaultDomain = platformFaultDomain; + RdpThumbPrint = rdpThumbPrint; + VmAgent = vmAgent; + MaintenanceRedeployStatus = maintenanceRedeployStatus; + Disks = disks; + Extensions = extensions; + VmHealth = vmHealth; + BootDiagnostics = bootDiagnostics; + Statuses = statuses; + AssignedHost = assignedHost; + PlacementGroupId = placementGroupId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Update Domain count. + /// + [JsonProperty(PropertyName = "platformUpdateDomain")] + public int? PlatformUpdateDomain { get; set; } + + /// + /// Gets or sets the Fault Domain count. + /// + [JsonProperty(PropertyName = "platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets the Remote desktop certificate thumbprint. + /// + [JsonProperty(PropertyName = "rdpThumbPrint")] + public string RdpThumbPrint { get; set; } + + /// + /// Gets or sets the VM Agent running on the virtual machine. + /// + [JsonProperty(PropertyName = "vmAgent")] + public VirtualMachineAgentInstanceView VmAgent { get; set; } + + /// + /// Gets or sets the Maintenance Operation status on the virtual + /// machine. + /// + [JsonProperty(PropertyName = "maintenanceRedeployStatus")] + public MaintenanceRedeployStatus MaintenanceRedeployStatus { get; set; } + + /// + /// Gets or sets the disks information. + /// + [JsonProperty(PropertyName = "disks")] + public IList Disks { get; set; } + + /// + /// Gets or sets the extensions information. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + /// + /// Gets the health status for the VM. + /// + [JsonProperty(PropertyName = "vmHealth")] + public VirtualMachineHealthStatus VmHealth { get; private set; } + + /// + /// Gets or sets boot Diagnostics is a debugging feature which allows + /// you to view Console Output and Screenshot to diagnose VM status. + /// &lt;br&gt;&lt;br&gt; You can easily view the output + /// of your console log. &lt;br&gt;&lt;br&gt; Azure + /// also enables you to see a screenshot of the VM from the hypervisor. + /// + [JsonProperty(PropertyName = "bootDiagnostics")] + public BootDiagnosticsInstanceView BootDiagnostics { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets resource id of the dedicated host, on which the virtual + /// machine is allocated through automatic placement, when the virtual + /// machine is associated with a dedicated host group that has + /// automatic placement enabled. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "assignedHost")] + public string AssignedHost { get; private set; } + + /// + /// Gets or sets the placement group in which the VM is running. If the + /// VM is deallocated it will not have a placementGroupId. + /// + [JsonProperty(PropertyName = "placementGroupId")] + public string PlacementGroupId { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMNetworkProfileConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMNetworkProfileConfiguration.cs new file mode 100644 index 0000000000000..f8e141cdd2b98 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMNetworkProfileConfiguration.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 virtual machine scale set VM network profile. + /// + public partial class VirtualMachineScaleSetVMNetworkProfileConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMNetworkProfileConfiguration class. + /// + public VirtualMachineScaleSetVMNetworkProfileConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMNetworkProfileConfiguration class. + /// + /// The list of network + /// configurations. + public VirtualMachineScaleSetVMNetworkProfileConfiguration(IList networkInterfaceConfigurations = default(IList)) + { + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of network configurations. + /// + [JsonProperty(PropertyName = "networkInterfaceConfigurations")] + public IList NetworkInterfaceConfigurations { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProfile.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProfile.cs new file mode 100644 index 0000000000000..fca9177e2f237 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProfile.cs @@ -0,0 +1,219 @@ +// +// 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 virtual machine scale set virtual machine profile. + /// + public partial class VirtualMachineScaleSetVMProfile + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMProfile + /// class. + /// + public VirtualMachineScaleSetVMProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMProfile + /// class. + /// + /// Specifies the operating system settings for + /// the virtual machines in the scale set. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies properties of the network + /// interfaces of the virtual machines in the scale set. + /// Specifies the Security related + /// profile settings for the virtual machines in the scale set. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// Specifies a collection of settings + /// 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) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the priority for the virtual + /// machines in the scale set. <br><br>Minimum api-version: + /// 2017-10-30-preview. Possible values include: 'Regular', 'Low', + /// 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. + /// <br><br>For Azure Spot virtual machines, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2019-03-01. <br><br>For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// Specifies the billing related details + /// of a Azure Spot VMSS. <br><br>Minimum api-version: + /// 2019-03-01. + /// Specifies Scheduled Event + /// related configurations. + public VirtualMachineScaleSetVMProfile(VirtualMachineScaleSetOSProfile osProfile = default(VirtualMachineScaleSetOSProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), VirtualMachineScaleSetStorageProfile storageProfile = default(VirtualMachineScaleSetStorageProfile), VirtualMachineScaleSetNetworkProfile networkProfile = default(VirtualMachineScaleSetNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile)) + { + OsProfile = osProfile; + ApplicationProfile = applicationProfile; + StorageProfile = storageProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + ExtensionProfile = extensionProfile; + LicenseType = licenseType; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + ScheduledEventsProfile = scheduledEventsProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the operating system settings for the + /// virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "osProfile")] + public VirtualMachineScaleSetOSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "storageProfile")] + public VirtualMachineScaleSetStorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies properties of the network interfaces of the + /// virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "networkProfile")] + public VirtualMachineScaleSetNetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2015-06-15. + /// + [JsonProperty(PropertyName = "diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets specifies a collection of settings for extensions + /// installed on virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "extensionProfile")] + public VirtualMachineScaleSetExtensionProfile ExtensionProfile { get; set; } + + /// + /// 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: + /// &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; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets or sets specifies the priority for the virtual machines in the + /// scale set. &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2017-10-30-preview. Possible values include: 'Regular', 'Low', + /// 'Spot' + /// + [JsonProperty(PropertyName = "priority")] + public string Priority { get; set; } + + /// + /// Gets or sets specifies the eviction policy for the Azure Spot + /// virtual machine and Azure Spot scale set. + /// &lt;br&gt;&lt;br&gt;For Azure Spot virtual + /// machines, both 'Deallocate' and 'Delete' are supported and the + /// minimum api-version is 2019-03-01. + /// &lt;br&gt;&lt;br&gt;For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// + [JsonProperty(PropertyName = "evictionPolicy")] + public string EvictionPolicy { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// VMSS. &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2019-03-01. + /// + [JsonProperty(PropertyName = "billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies Scheduled Event related configurations. + /// + [JsonProperty(PropertyName = "scheduledEventsProfile")] + public ScheduledEventsProfile ScheduledEventsProfile { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProtectionPolicy.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProtectionPolicy.cs new file mode 100644 index 0000000000000..73637dcff1c88 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMProtectionPolicy.cs @@ -0,0 +1,69 @@ +// +// 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 protection policy of a virtual machine scale set VM. + /// + public partial class VirtualMachineScaleSetVMProtectionPolicy + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMProtectionPolicy class. + /// + public VirtualMachineScaleSetVMProtectionPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMProtectionPolicy class. + /// + /// Indicates that the virtual machine + /// scale set VM shouldn't be considered for deletion during a scale-in + /// operation. + /// Indicates that model + /// updates or actions (including scale-in) initiated on the virtual + /// machine scale set should not be applied to the virtual machine + /// scale set VM. + public VirtualMachineScaleSetVMProtectionPolicy(bool? protectFromScaleIn = default(bool?), bool? protectFromScaleSetActions = default(bool?)) + { + ProtectFromScaleIn = protectFromScaleIn; + ProtectFromScaleSetActions = protectFromScaleSetActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates that the virtual machine scale set VM + /// shouldn't be considered for deletion during a scale-in operation. + /// + [JsonProperty(PropertyName = "protectFromScaleIn")] + public bool? ProtectFromScaleIn { get; set; } + + /// + /// Gets or sets indicates that model updates or actions (including + /// scale-in) initiated on the virtual machine scale set should not be + /// applied to the virtual machine scale set VM. + /// + [JsonProperty(PropertyName = "protectFromScaleSetActions")] + public bool? ProtectFromScaleSetActions { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMReimageParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMReimageParameters.cs new file mode 100644 index 0000000000000..120ffb1715b91 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetVMReimageParameters.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; + + /// + /// Describes a Virtual Machine Scale Set VM Reimage Parameters. + /// + public partial class VirtualMachineScaleSetVMReimageParameters : VirtualMachineReimageParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMReimageParameters class. + /// + public VirtualMachineScaleSetVMReimageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMReimageParameters class. + /// + /// Specifies whether to reimage temp disk. + /// Default value: false. Note: This temp disk reimage parameter is + /// only supported for VM/VMSS with Ephemeral OS disk. + public VirtualMachineScaleSetVMReimageParameters(bool? tempDisk = default(bool?)) + : base(tempDisk) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSize.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSize.cs new file mode 100644 index 0000000000000..116eee848dddf --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSize.cs @@ -0,0 +1,101 @@ +// +// 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 properties of a VM size. + /// + public partial class VirtualMachineSize + { + /// + /// Initializes a new instance of the VirtualMachineSize class. + /// + public VirtualMachineSize() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineSize class. + /// + /// The name of the virtual machine size. + /// The number of cores supported by the + /// virtual machine size. + /// The OS disk size, in MB, allowed by + /// the virtual machine size. + /// The resource disk size, in MB, + /// allowed by the virtual machine size. + /// The amount of memory, in MB, supported by + /// the virtual machine size. + /// The maximum number of data disks + /// that can be attached to the virtual machine size. + public VirtualMachineSize(string name = default(string), int? numberOfCores = default(int?), int? osDiskSizeInMB = default(int?), int? resourceDiskSizeInMB = default(int?), int? memoryInMB = default(int?), int? maxDataDiskCount = default(int?)) + { + Name = name; + NumberOfCores = numberOfCores; + OsDiskSizeInMB = osDiskSizeInMB; + ResourceDiskSizeInMB = resourceDiskSizeInMB; + MemoryInMB = memoryInMB; + MaxDataDiskCount = maxDataDiskCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the virtual machine size. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the number of cores supported by the virtual machine + /// size. + /// + [JsonProperty(PropertyName = "numberOfCores")] + public int? NumberOfCores { get; set; } + + /// + /// Gets or sets the OS disk size, in MB, allowed by the virtual + /// machine size. + /// + [JsonProperty(PropertyName = "osDiskSizeInMB")] + public int? OsDiskSizeInMB { get; set; } + + /// + /// Gets or sets the resource disk size, in MB, allowed by the virtual + /// machine size. + /// + [JsonProperty(PropertyName = "resourceDiskSizeInMB")] + public int? ResourceDiskSizeInMB { get; set; } + + /// + /// Gets or sets the amount of memory, in MB, supported by the virtual + /// machine size. + /// + [JsonProperty(PropertyName = "memoryInMB")] + public int? MemoryInMB { get; set; } + + /// + /// Gets or sets the maximum number of data disks that can be attached + /// to the virtual machine size. + /// + [JsonProperty(PropertyName = "maxDataDiskCount")] + public int? MaxDataDiskCount { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSizeTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSizeTypes.cs new file mode 100644 index 0000000000000..4b45aed4c4e6e --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSizeTypes.cs @@ -0,0 +1,186 @@ +// +// 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 VirtualMachineSizeTypes. + /// + public static class VirtualMachineSizeTypes + { + public const string BasicA0 = "Basic_A0"; + public const string BasicA1 = "Basic_A1"; + public const string BasicA2 = "Basic_A2"; + public const string BasicA3 = "Basic_A3"; + public const string BasicA4 = "Basic_A4"; + public const string StandardA0 = "Standard_A0"; + public const string StandardA1 = "Standard_A1"; + public const string StandardA2 = "Standard_A2"; + public const string StandardA3 = "Standard_A3"; + public const string StandardA4 = "Standard_A4"; + public const string StandardA5 = "Standard_A5"; + public const string StandardA6 = "Standard_A6"; + public const string StandardA7 = "Standard_A7"; + public const string StandardA8 = "Standard_A8"; + public const string StandardA9 = "Standard_A9"; + public const string StandardA10 = "Standard_A10"; + public const string StandardA11 = "Standard_A11"; + public const string StandardA1V2 = "Standard_A1_v2"; + public const string StandardA2V2 = "Standard_A2_v2"; + public const string StandardA4V2 = "Standard_A4_v2"; + public const string StandardA8V2 = "Standard_A8_v2"; + public const string StandardA2mV2 = "Standard_A2m_v2"; + public const string StandardA4mV2 = "Standard_A4m_v2"; + public const string StandardA8mV2 = "Standard_A8m_v2"; + public const string StandardB1s = "Standard_B1s"; + public const string StandardB1ms = "Standard_B1ms"; + public const string StandardB2s = "Standard_B2s"; + public const string StandardB2ms = "Standard_B2ms"; + public const string StandardB4ms = "Standard_B4ms"; + public const string StandardB8ms = "Standard_B8ms"; + public const string StandardD1 = "Standard_D1"; + public const string StandardD2 = "Standard_D2"; + public const string StandardD3 = "Standard_D3"; + public const string StandardD4 = "Standard_D4"; + public const string StandardD11 = "Standard_D11"; + public const string StandardD12 = "Standard_D12"; + public const string StandardD13 = "Standard_D13"; + public const string StandardD14 = "Standard_D14"; + public const string StandardD1V2 = "Standard_D1_v2"; + public const string StandardD2V2 = "Standard_D2_v2"; + public const string StandardD3V2 = "Standard_D3_v2"; + public const string StandardD4V2 = "Standard_D4_v2"; + public const string StandardD5V2 = "Standard_D5_v2"; + public const string StandardD2V3 = "Standard_D2_v3"; + public const string StandardD4V3 = "Standard_D4_v3"; + public const string StandardD8V3 = "Standard_D8_v3"; + public const string StandardD16V3 = "Standard_D16_v3"; + public const string StandardD32V3 = "Standard_D32_v3"; + public const string StandardD64V3 = "Standard_D64_v3"; + public const string StandardD2sV3 = "Standard_D2s_v3"; + public const string StandardD4sV3 = "Standard_D4s_v3"; + public const string StandardD8sV3 = "Standard_D8s_v3"; + public const string StandardD16sV3 = "Standard_D16s_v3"; + public const string StandardD32sV3 = "Standard_D32s_v3"; + public const string StandardD64sV3 = "Standard_D64s_v3"; + public const string StandardD11V2 = "Standard_D11_v2"; + public const string StandardD12V2 = "Standard_D12_v2"; + public const string StandardD13V2 = "Standard_D13_v2"; + public const string StandardD14V2 = "Standard_D14_v2"; + public const string StandardD15V2 = "Standard_D15_v2"; + public const string StandardDS1 = "Standard_DS1"; + public const string StandardDS2 = "Standard_DS2"; + public const string StandardDS3 = "Standard_DS3"; + public const string StandardDS4 = "Standard_DS4"; + public const string StandardDS11 = "Standard_DS11"; + public const string StandardDS12 = "Standard_DS12"; + public const string StandardDS13 = "Standard_DS13"; + public const string StandardDS14 = "Standard_DS14"; + public const string StandardDS1V2 = "Standard_DS1_v2"; + public const string StandardDS2V2 = "Standard_DS2_v2"; + public const string StandardDS3V2 = "Standard_DS3_v2"; + public const string StandardDS4V2 = "Standard_DS4_v2"; + public const string StandardDS5V2 = "Standard_DS5_v2"; + public const string StandardDS11V2 = "Standard_DS11_v2"; + public const string StandardDS12V2 = "Standard_DS12_v2"; + public const string StandardDS13V2 = "Standard_DS13_v2"; + public const string StandardDS14V2 = "Standard_DS14_v2"; + public const string StandardDS15V2 = "Standard_DS15_v2"; + public const string StandardDS134V2 = "Standard_DS13-4_v2"; + public const string StandardDS132V2 = "Standard_DS13-2_v2"; + public const string StandardDS148V2 = "Standard_DS14-8_v2"; + public const string StandardDS144V2 = "Standard_DS14-4_v2"; + public const string StandardE2V3 = "Standard_E2_v3"; + public const string StandardE4V3 = "Standard_E4_v3"; + public const string StandardE8V3 = "Standard_E8_v3"; + public const string StandardE16V3 = "Standard_E16_v3"; + public const string StandardE32V3 = "Standard_E32_v3"; + public const string StandardE64V3 = "Standard_E64_v3"; + public const string StandardE2sV3 = "Standard_E2s_v3"; + public const string StandardE4sV3 = "Standard_E4s_v3"; + public const string StandardE8sV3 = "Standard_E8s_v3"; + public const string StandardE16sV3 = "Standard_E16s_v3"; + public const string StandardE32sV3 = "Standard_E32s_v3"; + public const string StandardE64sV3 = "Standard_E64s_v3"; + public const string StandardE3216V3 = "Standard_E32-16_v3"; + public const string StandardE328sV3 = "Standard_E32-8s_v3"; + public const string StandardE6432sV3 = "Standard_E64-32s_v3"; + public const string StandardE6416sV3 = "Standard_E64-16s_v3"; + public const string StandardF1 = "Standard_F1"; + public const string StandardF2 = "Standard_F2"; + public const string StandardF4 = "Standard_F4"; + public const string StandardF8 = "Standard_F8"; + public const string StandardF16 = "Standard_F16"; + public const string StandardF1s = "Standard_F1s"; + public const string StandardF2s = "Standard_F2s"; + public const string StandardF4s = "Standard_F4s"; + public const string StandardF8s = "Standard_F8s"; + public const string StandardF16s = "Standard_F16s"; + public const string StandardF2sV2 = "Standard_F2s_v2"; + public const string StandardF4sV2 = "Standard_F4s_v2"; + public const string StandardF8sV2 = "Standard_F8s_v2"; + public const string StandardF16sV2 = "Standard_F16s_v2"; + public const string StandardF32sV2 = "Standard_F32s_v2"; + public const string StandardF64sV2 = "Standard_F64s_v2"; + public const string StandardF72sV2 = "Standard_F72s_v2"; + public const string StandardG1 = "Standard_G1"; + public const string StandardG2 = "Standard_G2"; + public const string StandardG3 = "Standard_G3"; + public const string StandardG4 = "Standard_G4"; + public const string StandardG5 = "Standard_G5"; + public const string StandardGS1 = "Standard_GS1"; + public const string StandardGS2 = "Standard_GS2"; + public const string StandardGS3 = "Standard_GS3"; + public const string StandardGS4 = "Standard_GS4"; + public const string StandardGS5 = "Standard_GS5"; + public const string StandardGS48 = "Standard_GS4-8"; + public const string StandardGS44 = "Standard_GS4-4"; + public const string StandardGS516 = "Standard_GS5-16"; + public const string StandardGS58 = "Standard_GS5-8"; + public const string StandardH8 = "Standard_H8"; + public const string StandardH16 = "Standard_H16"; + public const string StandardH8m = "Standard_H8m"; + public const string StandardH16m = "Standard_H16m"; + public const string StandardH16r = "Standard_H16r"; + public const string StandardH16mr = "Standard_H16mr"; + public const string StandardL4s = "Standard_L4s"; + public const string StandardL8s = "Standard_L8s"; + public const string StandardL16s = "Standard_L16s"; + public const string StandardL32s = "Standard_L32s"; + public const string StandardM64s = "Standard_M64s"; + public const string StandardM64ms = "Standard_M64ms"; + public const string StandardM128s = "Standard_M128s"; + public const string StandardM128ms = "Standard_M128ms"; + public const string StandardM6432ms = "Standard_M64-32ms"; + public const string StandardM6416ms = "Standard_M64-16ms"; + public const string StandardM12864ms = "Standard_M128-64ms"; + public const string StandardM12832ms = "Standard_M128-32ms"; + public const string StandardNC6 = "Standard_NC6"; + public const string StandardNC12 = "Standard_NC12"; + public const string StandardNC24 = "Standard_NC24"; + public const string StandardNC24r = "Standard_NC24r"; + public const string StandardNC6sV2 = "Standard_NC6s_v2"; + public const string StandardNC12sV2 = "Standard_NC12s_v2"; + public const string StandardNC24sV2 = "Standard_NC24s_v2"; + public const string StandardNC24rsV2 = "Standard_NC24rs_v2"; + public const string StandardNC6sV3 = "Standard_NC6s_v3"; + public const string StandardNC12sV3 = "Standard_NC12s_v3"; + public const string StandardNC24sV3 = "Standard_NC24s_v3"; + public const string StandardNC24rsV3 = "Standard_NC24rs_v3"; + public const string StandardND6s = "Standard_ND6s"; + public const string StandardND12s = "Standard_ND12s"; + public const string StandardND24s = "Standard_ND24s"; + public const string StandardND24rs = "Standard_ND24rs"; + public const string StandardNV6 = "Standard_NV6"; + public const string StandardNV12 = "Standard_NV12"; + public const string StandardNV24 = "Standard_NV24"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs new file mode 100644 index 0000000000000..bc709ce1f948c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs @@ -0,0 +1,143 @@ +// +// 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 properties of a Virtual Machine software patch. + /// + public partial class VirtualMachineSoftwarePatchProperties + { + /// + /// Initializes a new instance of the + /// VirtualMachineSoftwarePatchProperties class. + /// + public VirtualMachineSoftwarePatchProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineSoftwarePatchProperties class. + /// + /// A unique identifier for the patch. + /// The friendly name of the patch. + /// The version number of the patch. This + /// property applies only to Linux patches. + /// The KBID of the patch. Only applies to Windows + /// patches. + /// The classification(s) of the patch as + /// provided by the patch publisher. + /// Describes the reboot requirements of + /// the patch. Possible values include: 'Unknown', 'NeverReboots', + /// 'AlwaysRequiresReboot', 'CanRequestReboot' + /// The activity ID of the operation that + /// produced this result. It is used to correlate across CRP and + /// extension logs. + /// The UTC timestamp when the repository + /// published this patch. + /// The UTC timestamp of the last + /// update to this patch record. + /// Describes the availability of a given + /// patch. Possible values include: 'Unknown', 'Available' + public VirtualMachineSoftwarePatchProperties(string patchId = default(string), string name = default(string), string version = default(string), string kbId = default(string), IList classifications = default(IList), string rebootBehavior = default(string), string activityId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? lastModifiedDateTime = default(System.DateTime?), string assessmentState = default(string)) + { + PatchId = patchId; + Name = name; + Version = version; + KbId = kbId; + Classifications = classifications; + RebootBehavior = rebootBehavior; + ActivityId = activityId; + PublishedDate = publishedDate; + LastModifiedDateTime = lastModifiedDateTime; + AssessmentState = assessmentState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique identifier for the patch. + /// + [JsonProperty(PropertyName = "patchId")] + public string PatchId { get; private set; } + + /// + /// Gets the friendly name of the patch. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the version number of the patch. This property applies only to + /// Linux patches. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + /// + /// Gets the KBID of the patch. Only applies to Windows patches. + /// + [JsonProperty(PropertyName = "kbId")] + public string KbId { get; private set; } + + /// + /// Gets the classification(s) of the patch as provided by the patch + /// publisher. + /// + [JsonProperty(PropertyName = "classifications")] + public IList Classifications { get; private set; } + + /// + /// Gets describes the reboot requirements of the patch. Possible + /// values include: 'Unknown', 'NeverReboots', 'AlwaysRequiresReboot', + /// 'CanRequestReboot' + /// + [JsonProperty(PropertyName = "rebootBehavior")] + public string RebootBehavior { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "activityId")] + public string ActivityId { get; private set; } + + /// + /// Gets the UTC timestamp when the repository published this patch. + /// + [JsonProperty(PropertyName = "publishedDate")] + public System.DateTime? PublishedDate { get; private set; } + + /// + /// Gets the UTC timestamp of the last update to this patch record. + /// + [JsonProperty(PropertyName = "lastModifiedDateTime")] + public System.DateTime? LastModifiedDateTime { get; private set; } + + /// + /// Gets describes the availability of a given patch. Possible values + /// include: 'Unknown', 'Available' + /// + [JsonProperty(PropertyName = "assessmentState")] + public string AssessmentState { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.cs new file mode 100644 index 0000000000000..3c614f4e1aac5 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.cs @@ -0,0 +1,63 @@ +// +// 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 status code and count of the virtual machine scale set instance + /// view status summary. + /// + public partial class VirtualMachineStatusCodeCount + { + /// + /// Initializes a new instance of the VirtualMachineStatusCodeCount + /// class. + /// + public VirtualMachineStatusCodeCount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineStatusCodeCount + /// class. + /// + /// The instance view status code. + /// The number of instances having a particular + /// status code. + public VirtualMachineStatusCodeCount(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 the number of instances having a particular status code. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; private set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineUpdate.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineUpdate.cs new file mode 100644 index 0000000000000..3880a7a2c1995 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineUpdate.cs @@ -0,0 +1,446 @@ +// +// 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; + + /// + /// Describes a Virtual Machine Update. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineUpdate : UpdateResource + { + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + public VirtualMachineUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + /// Resource tags + /// Specifies information about the marketplace + /// image used to create the virtual machine. This element is only used + /// for marketplace images. Before you can use a marketplace image from + /// an API, you must enable the image for programmatic use. In the + /// Azure portal, find the marketplace image that you want to use and + /// then click **Want to deploy programmatically, Get Started ->**. + /// Enter any required information and then click **Save**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// Specifies information about the + /// availability set that the virtual machine should be assigned to. + /// Virtual machines specified in the same availability set are + /// allocated to different nodes to maximize availability. For more + /// information about availability sets, see [Manage the availability + /// of virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// <br><br> For more information on Azure planned + /// maintenance, see [Planned maintenance for virtual machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. The availability set to which + /// the VM is being added should be under the same resource group as + /// the availability set resource. An existing VM cannot be added to an + /// availability set. <br><br>This property cannot exist + /// along with a non-null properties.virtualMachineScaleSet + /// reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. <br><br>This property cannot + /// exist along with a non-null properties.availabilitySet reference. + /// <br><br>Minimum api‐version: 2019‐03‐01 + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains.<br><li>This is applicable only if the + /// 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.<li>The Virtual Machine Scale Set that is referenced, + /// must have 'platformFaultDomainCount' &gt; 1.<li>This + /// property cannot be updated once the Virtual Machine is + /// created.<li>Fault domain assignment can be viewed in the + /// Virtual Machine Instance View.<br><br>Minimum + /// api‐version: 2020‐12‐01 + /// Specifies the priority for the virtual + /// machine. <br><br>Minimum api-version: 2019-03-01. + /// Possible values include: 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. + /// <br><br>For Azure Spot virtual machines, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2019-03-01. <br><br>For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. <br><br>Minimum + /// api-version: 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. <br><br>Minimum + /// api-version: 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// <br><br>NOTE: User cannot specify both host and + /// hostGroup properties. + /// The provisioning state, which only + /// appears in the response. + /// 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) + /// <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 + /// and can be read using platform BIOS commands. + /// Specifies the time alloted for + /// all extensions to start. The time duration should be between 15 + /// minutes and 120 minutes (inclusive) and should be specified in ISO + /// 8601 format. The default value is 90 minutes (PT1H30M). + /// <br><br> Minimum api-version: 2020-06-01 + /// The identity of the virtual machine, if + /// configured. + /// The virtual machine zones. + public VirtualMachineUpdate(IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), int? platformFaultDomain = default(int?), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList)) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + ApplicationProfile = applicationProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + PlatformFaultDomain = platformFaultDomain; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + Identity = identity; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies information about the marketplace image used + /// to create the virtual machine. This element is only used for + /// marketplace images. Before you can use a marketplace image from an + /// API, you must enable the image for programmatic use. In the Azure + /// portal, find the marketplace image that you want to use and then + /// click **Want to deploy programmatically, Get Started -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets specifies the hardware settings for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.hardwareProfile")] + public HardwareProfile HardwareProfile { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the operating system settings used while + /// creating the virtual machine. Some of the settings cannot be + /// changed once VM is provisioned. + /// + [JsonProperty(PropertyName = "properties.osProfile")] + public OSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the network interfaces of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machine. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2015-06-15. + /// + [JsonProperty(PropertyName = "properties.diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets specifies information about the availability set that + /// the virtual machine should be assigned to. Virtual machines + /// specified in the same availability set are allocated to different + /// nodes to maximize availability. For more information about + /// availability sets, see [Manage the availability of virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + /// &lt;br&gt;&lt;br&gt; For more information on Azure + /// planned maintenance, see [Planned maintenance for virtual machines + /// in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + /// &lt;br&gt;&lt;br&gt; Currently, a VM can only be + /// added to availability set at creation time. The availability set to + /// which the VM is being added should be under the same resource group + /// as the availability set resource. An existing VM cannot be added to + /// an availability set. &lt;br&gt;&lt;br&gt;This + /// property cannot exist along with a non-null + /// properties.virtualMachineScaleSet reference. + /// + [JsonProperty(PropertyName = "properties.availabilitySet")] + public SubResource AvailabilitySet { get; set; } + + /// + /// Gets or sets specifies information about the virtual machine scale + /// set that the virtual machine should be assigned to. Virtual + /// machines specified in the same virtual machine scale set are + /// allocated to different nodes to maximize availability. Currently, a + /// VM can only be added to virtual machine scale set at creation time. + /// An existing VM cannot be added to a virtual machine scale set. + /// &lt;br&gt;&lt;br&gt;This property cannot exist + /// along with a non-null properties.availabilitySet reference. + /// &lt;br&gt;&lt;br&gt;Minimum api‐version: 2019‐03‐01 + /// + [JsonProperty(PropertyName = "properties.virtualMachineScaleSet")] + public SubResource VirtualMachineScaleSet { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine should be assigned to. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets specifies the scale set logical fault domain into + /// which the Virtual Machine will be created. By default, the Virtual + /// Machine will by automatically assigned to a fault domain that best + /// maintains balance across available fault + /// domains.&lt;br&gt;&lt;li&gt;This is applicable only + /// if the 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.&lt;li&gt;The Virtual Machine Scale Set that is + /// referenced, must have 'platformFaultDomainCount' &amp;gt; + /// 1.&lt;li&gt;This property cannot be updated once the + /// Virtual Machine is created.&lt;li&gt;Fault domain + /// assignment can be viewed in the Virtual Machine Instance + /// View.&lt;br&gt;&lt;br&gt;Minimum api‐version: + /// 2020‐12‐01 + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies the priority for the virtual machine. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2019-03-01. Possible values include: 'Regular', 'Low', 'Spot' + /// + [JsonProperty(PropertyName = "properties.priority")] + public string Priority { get; set; } + + /// + /// Gets or sets specifies the eviction policy for the Azure Spot + /// virtual machine and Azure Spot scale set. + /// &lt;br&gt;&lt;br&gt;For Azure Spot virtual + /// machines, both 'Deallocate' and 'Delete' are supported and the + /// minimum api-version is 2019-03-01. + /// &lt;br&gt;&lt;br&gt;For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// + [JsonProperty(PropertyName = "properties.evictionPolicy")] + public string EvictionPolicy { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// virtual machine. &lt;br&gt;&lt;br&gt;Minimum + /// api-version: 2019-03-01. + /// + [JsonProperty(PropertyName = "properties.billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host that + /// the virtual machine resides in. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-10-01. + /// + [JsonProperty(PropertyName = "properties.host")] + public SubResource Host { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host group + /// that the virtual machine resides in. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2020-06-01. &lt;br&gt;&lt;br&gt;NOTE: User cannot + /// specify both host and hostGroup properties. + /// + [JsonProperty(PropertyName = "properties.hostGroup")] + public SubResource HostGroup { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the virtual machine instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineInstanceView InstanceView { get; private set; } + + /// + /// 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: + /// &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; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets specifies the VM unique ID which is a 128-bits identifier that + /// is encoded and stored in all Azure IaaS VMs SMBIOS and can be read + /// using platform BIOS commands. + /// + [JsonProperty(PropertyName = "properties.vmId")] + public string VmId { get; private set; } + + /// + /// Gets or sets specifies the time alloted for all extensions to + /// start. The time duration should be between 15 minutes and 120 + /// minutes (inclusive) and should be specified in ISO 8601 format. The + /// default value is 90 minutes (PT1H30M). + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2020-06-01 + /// + [JsonProperty(PropertyName = "properties.extensionsTimeBudget")] + public string ExtensionsTimeBudget { get; set; } + + /// + /// Gets or sets the identity of the virtual machine, if configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineIdentity Identity { get; set; } + + /// + /// Gets or sets the virtual machine zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VmDiskTypes.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VmDiskTypes.cs new file mode 100644 index 0000000000000..6b98cea8d9449 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VmDiskTypes.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 VmDiskTypes. + /// + public static class VmDiskTypes + { + public const string None = "None"; + public const string Unmanaged = "Unmanaged"; + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WinRMConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WinRMConfiguration.cs new file mode 100644 index 0000000000000..2a7f723e723c6 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WinRMConfiguration.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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes Windows Remote Management configuration of the VM + /// + public partial class WinRMConfiguration + { + /// + /// Initializes a new instance of the WinRMConfiguration class. + /// + public WinRMConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WinRMConfiguration class. + /// + /// The list of Windows Remote Management + /// listeners + public WinRMConfiguration(IList listeners = default(IList)) + { + Listeners = listeners; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of Windows Remote Management listeners + /// + [JsonProperty(PropertyName = "listeners")] + public IList Listeners { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WinRMListener.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WinRMListener.cs new file mode 100644 index 0000000000000..9f7135a0e8cf8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WinRMListener.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.Linq; + + /// + /// Describes Protocol and thumbprint of Windows Remote Management listener + /// + public partial class WinRMListener + { + /// + /// Initializes a new instance of the WinRMListener class. + /// + public WinRMListener() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WinRMListener class. + /// + /// Specifies the protocol of WinRM listener. + /// <br><br> Possible values are: <br>**http** + /// <br><br> **https**. Possible values include: 'Http', + /// 'Https' + /// This is the URL of a certificate that + /// has been uploaded to Key Vault as a secret. For adding a secret to + /// the Key Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// <br><br> {<br> + /// "data":"<Base64-encoded-certificate>",<br> + /// "dataType":"pfx",<br> + /// "password":"<pfx-file-password>"<br>} + public WinRMListener(ProtocolTypes? protocol = default(ProtocolTypes?), string certificateUrl = default(string)) + { + Protocol = protocol; + CertificateUrl = certificateUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the protocol of WinRM listener. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;**http** &lt;br&gt;&lt;br&gt; + /// **https**. Possible values include: 'Http', 'Https' + /// + [JsonProperty(PropertyName = "protocol")] + public ProtocolTypes? Protocol { get; set; } + + /// + /// Gets or sets this is the URL of a certificate that has been + /// uploaded to Key Vault as a secret. For adding a secret to the Key + /// Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// &lt;br&gt;&lt;br&gt; {&lt;br&gt; + /// "data":"&lt;Base64-encoded-certificate&gt;",&lt;br&gt; + /// "dataType":"pfx",&lt;br&gt; + /// "password":"&lt;pfx-file-password&gt;"&lt;br&gt;} + /// + [JsonProperty(PropertyName = "certificateUrl")] + public string CertificateUrl { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsConfiguration.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsConfiguration.cs new file mode 100644 index 0000000000000..e7e53c0d01f20 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsConfiguration.cs @@ -0,0 +1,129 @@ +// +// 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; + + /// + /// Specifies Windows operating system settings on the virtual machine. + /// + public partial class WindowsConfiguration + { + /// + /// Initializes a new instance of the WindowsConfiguration class. + /// + public WindowsConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsConfiguration class. + /// + /// Indicates whether virtual machine + /// agent should be provisioned on the virtual machine. + /// <br><br> When this property is not specified in the + /// request body, default behavior is to set it to true. This will + /// ensure that VM Agent is installed on the VM so that extensions can + /// be added to the VM later. + /// Indicates whether Automatic + /// Updates is enabled for the Windows virtual machine. Default value + /// is true. <br><br> For virtual machine scale sets, this + /// property can be updated and updates will take effect on OS + /// reprovisioning. + /// Specifies the time zone of the virtual + /// machine. e.g. "Pacific Standard Time". <br><br> + /// Possible values can be + /// [TimeZoneInfo.Id](https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + /// value from time zones returned by + /// [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.getsystemtimezones). + /// Specifies additional + /// base-64 encoded XML formatted information that can be included in + /// the Unattend.xml file, which is used by Windows Setup. + /// Specifies settings related to VM Guest + /// Patching on Windows. + /// Specifies the Windows Remote Management + /// listeners. This enables remote Windows PowerShell. + public WindowsConfiguration(bool? provisionVMAgent = default(bool?), bool? enableAutomaticUpdates = default(bool?), string timeZone = default(string), IList additionalUnattendContent = default(IList), WindowsPatchSettings patchSettings = default(WindowsPatchSettings), WinRMConfiguration winRM = default(WinRMConfiguration)) + { + ProvisionVMAgent = provisionVMAgent; + EnableAutomaticUpdates = enableAutomaticUpdates; + TimeZone = timeZone; + AdditionalUnattendContent = additionalUnattendContent; + PatchSettings = patchSettings; + WinRM = winRM; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether virtual machine agent should be + /// provisioned on the virtual machine. + /// &lt;br&gt;&lt;br&gt; When this property is not + /// specified in the request body, default behavior is to set it to + /// true. This will ensure that VM Agent is installed on the VM so + /// that extensions can be added to the VM later. + /// + [JsonProperty(PropertyName = "provisionVMAgent")] + public bool? ProvisionVMAgent { get; set; } + + /// + /// Gets or sets indicates whether Automatic Updates is enabled for the + /// Windows virtual machine. Default value is true. + /// &lt;br&gt;&lt;br&gt; For virtual machine scale + /// sets, this property can be updated and updates will take effect on + /// OS reprovisioning. + /// + [JsonProperty(PropertyName = "enableAutomaticUpdates")] + public bool? EnableAutomaticUpdates { get; set; } + + /// + /// Gets or sets specifies the time zone of the virtual machine. e.g. + /// "Pacific Standard Time". &lt;br&gt;&lt;br&gt; + /// Possible values can be + /// [TimeZoneInfo.Id](https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + /// value from time zones returned by + /// [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.getsystemtimezones). + /// + [JsonProperty(PropertyName = "timeZone")] + public string TimeZone { get; set; } + + /// + /// Gets or sets specifies additional base-64 encoded XML formatted + /// information that can be included in the Unattend.xml file, which is + /// used by Windows Setup. + /// + [JsonProperty(PropertyName = "additionalUnattendContent")] + public IList AdditionalUnattendContent { get; set; } + + /// + /// Gets or sets specifies settings related to VM Guest Patching on + /// Windows. + /// + [JsonProperty(PropertyName = "patchSettings")] + public WindowsPatchSettings PatchSettings { get; set; } + + /// + /// Gets or sets specifies the Windows Remote Management listeners. + /// This enables remote Windows PowerShell. + /// + [JsonProperty(PropertyName = "winRM")] + public WinRMConfiguration WinRM { get; set; } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsParameters.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsParameters.cs new file mode 100644 index 0000000000000..230533edc19de --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsParameters.cs @@ -0,0 +1,97 @@ +// +// 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; + + /// + /// Input for InstallPatches on a Windows VM, as directly received by the + /// API + /// + public partial class WindowsParameters + { + /// + /// Initializes a new instance of the WindowsParameters class. + /// + public WindowsParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsParameters class. + /// + /// The update classifications + /// to select when installing patches for Windows. + /// Kbs to include in the patch + /// operation + /// Kbs to exclude in the patch + /// operation + /// Filters out Kbs that don't + /// have an InstallationRebootBehavior of 'NeverReboots' when this is + /// set to true. + /// This is used to install patches + /// that were published on or before this given max published + /// date. + public WindowsParameters(IList classificationsToInclude = default(IList), IList kbNumbersToInclude = default(IList), IList kbNumbersToExclude = default(IList), bool? excludeKbsRequiringReboot = default(bool?), System.DateTime? maxPatchPublishDate = default(System.DateTime?)) + { + ClassificationsToInclude = classificationsToInclude; + KbNumbersToInclude = kbNumbersToInclude; + KbNumbersToExclude = kbNumbersToExclude; + ExcludeKbsRequiringReboot = excludeKbsRequiringReboot; + MaxPatchPublishDate = maxPatchPublishDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the update classifications to select when installing + /// patches for Windows. + /// + [JsonProperty(PropertyName = "classificationsToInclude")] + public IList ClassificationsToInclude { get; set; } + + /// + /// Gets or sets kbs to include in the patch operation + /// + [JsonProperty(PropertyName = "kbNumbersToInclude")] + public IList KbNumbersToInclude { get; set; } + + /// + /// Gets or sets kbs to exclude in the patch operation + /// + [JsonProperty(PropertyName = "kbNumbersToExclude")] + public IList KbNumbersToExclude { get; set; } + + /// + /// Gets or sets filters out Kbs that don't have an + /// InstallationRebootBehavior of 'NeverReboots' when this is set to + /// true. + /// + [JsonProperty(PropertyName = "excludeKbsRequiringReboot")] + public bool? ExcludeKbsRequiringReboot { get; set; } + + /// + /// Gets or sets this is used to install patches that were published on + /// or before this given max published date. + /// + [JsonProperty(PropertyName = "maxPatchPublishDate")] + public System.DateTime? MaxPatchPublishDate { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchSettings.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsPatchSettings.cs similarity index 69% rename from sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchSettings.cs rename to compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsPatchSettings.cs index 730f6ca2e8065..fc02a235c109e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchSettings.cs +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsPatchSettings.cs @@ -13,20 +13,23 @@ namespace Microsoft.Azure.Management.Compute.Models using Newtonsoft.Json; using System.Linq; - public partial class PatchSettings + /// + /// Specifies settings related to VM Guest Patching on Windows. + /// + public partial class WindowsPatchSettings { /// - /// Initializes a new instance of the PatchSettings class. + /// Initializes a new instance of the WindowsPatchSettings class. /// - public PatchSettings() + public WindowsPatchSettings() { CustomInit(); } /// - /// Initializes a new instance of the PatchSettings class. + /// Initializes a new instance of the WindowsPatchSettings class. /// - /// Specifies the mode of in-guest patching to + /// Specifies the mode of VM Guest Patching to /// IaaS virtual machine.<br /><br /> Possible values /// are:<br /><br /> **Manual** - You control the /// application of patches to a virtual machine. You do this by @@ -41,9 +44,14 @@ public PatchSettings() /// provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates /// must be true. Possible values include: 'Manual', 'AutomaticByOS', /// 'AutomaticByPlatform' - public PatchSettings(string patchMode = default(string)) + /// Enables customers to patch their + /// Azure VMs without requiring a reboot. For enableHotpatching, the + /// 'provisionVMAgent' must be set to true and 'patchMode' must be set + /// to 'AutomaticByPlatform'. + public WindowsPatchSettings(string patchMode = default(string), bool? enableHotpatching = default(bool?)) { PatchMode = patchMode; + EnableHotpatching = enableHotpatching; CustomInit(); } @@ -53,7 +61,7 @@ public PatchSettings() partial void CustomInit(); /// - /// Gets or sets specifies the mode of in-guest patching to IaaS + /// Gets or sets specifies the mode of VM Guest Patching to IaaS /// virtual machine.&lt;br /&gt;&lt;br /&gt; Possible /// values are:&lt;br /&gt;&lt;br /&gt; **Manual** - /// You control the application of patches to a virtual machine. You @@ -72,5 +80,14 @@ public PatchSettings() [JsonProperty(PropertyName = "patchMode")] public string PatchMode { get; set; } + /// + /// Gets or sets enables customers to patch their Azure VMs without + /// requiring a reboot. For enableHotpatching, the 'provisionVMAgent' + /// must be set to true and 'patchMode' must be set to + /// 'AutomaticByPlatform'. + /// + [JsonProperty(PropertyName = "enableHotpatching")] + public bool? EnableHotpatching { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InGuestPatchMode.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsVMGuestPatchMode.cs similarity index 86% rename from sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InGuestPatchMode.cs rename to compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsVMGuestPatchMode.cs index 42af3578b1533..e3c4970c7b0f3 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/InGuestPatchMode.cs +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsVMGuestPatchMode.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.Compute.Models { /// - /// Defines values for InGuestPatchMode. + /// Defines values for WindowsVMGuestPatchMode. /// - public static class InGuestPatchMode + public static class WindowsVMGuestPatchMode { public const string Manual = "Manual"; public const string AutomaticByOS = "AutomaticByOS"; diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs new file mode 100644 index 0000000000000..3e58df5747bc1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs @@ -0,0 +1,219 @@ +// +// 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(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 list of compute operations. + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2020-12-01"; + // 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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Compute/operations").ToString(); + 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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/OperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..5f8d049c48f2a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/OperationsExtensions.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 +{ + 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 Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Gets a list of compute operations. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of compute operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs new file mode 100644 index 0000000000000..5026ed7ba8236 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs @@ -0,0 +1,1576 @@ +// +// 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; + + /// + /// ProximityPlacementGroupsOperations operations. + /// + internal partial class ProximityPlacementGroupsOperations : IServiceOperations, IProximityPlacementGroupsOperations + { + /// + /// Initializes a new instance of the ProximityPlacementGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProximityPlacementGroupsOperations(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 proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _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 proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + ProximityPlacementGroupUpdate parameters = new ProximityPlacementGroupUpdate(); + if (tags != null) + { + 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("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _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; + } + + /// + /// Delete a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _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) + { + 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; + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status of all + /// the resources in the proximity placement 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> GetWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("includeColocationStatus", includeColocationStatus); + 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/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (includeColocationStatus != null) + { + _queryParameters.Add(string.Format("includeColocationStatus={0}", System.Uri.EscapeDataString(includeColocationStatus))); + } + 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; + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups").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; + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(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-12-01"; + // 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, "ListByResourceGroup", 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/proximityPlacementGroups").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; + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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; + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperationsExtensions.cs new file mode 100644 index 0000000000000..81148c9ca4c6b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperationsExtensions.cs @@ -0,0 +1,334 @@ +// +// 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 ProximityPlacementGroupsOperations. + /// + public static partial class ProximityPlacementGroupsOperationsExtensions + { + /// + /// Create or update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group operation. + /// + public static ProximityPlacementGroup CreateOrUpdate(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, proximityPlacementGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Resource tags + /// + public static ProximityPlacementGroup Update(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, proximityPlacementGroupName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + public static void Delete(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName) + { + operations.DeleteAsync(resourceGroupName, proximityPlacementGroupName).GetAwaiter().GetResult(); + } + + /// + /// Delete a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status of all + /// the resources in the proximity placement group. + /// + public static ProximityPlacementGroup Get(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string)) + { + return operations.GetAsync(resourceGroupName, proximityPlacementGroupName, includeColocationStatus).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status of all + /// the resources in the proximity placement group. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, includeColocationStatus, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IProximityPlacementGroupsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IProximityPlacementGroupsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IProximityPlacementGroupsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IProximityPlacementGroupsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IProximityPlacementGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IProximityPlacementGroupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IProximityPlacementGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperations.cs new file mode 100644 index 0000000000000..bf945fdc2bef8 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperations.cs @@ -0,0 +1,412 @@ +// +// 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; + + /// + /// ResourceSkusOperations operations. + /// + internal partial class ResourceSkusOperations : IServiceOperations, IResourceSkusOperations + { + /// + /// Initializes a new instance of the ResourceSkusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ResourceSkusOperations(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 the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported + /// currently. + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); + 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/skus").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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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 Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperationsExtensions.cs new file mode 100644 index 0000000000000..7709c03c953a4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperationsExtensions.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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ResourceSkusOperations. + /// + public static partial class ResourceSkusOperationsExtensions + { + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported + /// currently. + /// + public static IPage List(this IResourceSkusOperations operations, string filter = default(string)) + { + return operations.ListAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported + /// currently. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IResourceSkusOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IResourceSkusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// 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 IResourceSkusOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs new file mode 100644 index 0000000000000..2c057e9039d51 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs @@ -0,0 +1,62 @@ + +// +// 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 System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ComputeManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Compute", "AvailabilitySets", "2020-12-01"), + new Tuple("Compute", "DedicatedHostGroups", "2020-12-01"), + new Tuple("Compute", "DedicatedHosts", "2020-12-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", "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-12-01"), + new Tuple("Compute", "LogAnalytics", "2020-12-01"), + new Tuple("Compute", "Operations", "2020-12-01"), + new Tuple("Compute", "ProximityPlacementGroups", "2020-12-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-12-01"), + new Tuple("Compute", "Usage", "2020-12-01"), + new Tuple("Compute", "VirtualMachineExtensionImages", "2020-12-01"), + new Tuple("Compute", "VirtualMachineExtensions", "2020-12-01"), + new Tuple("Compute", "VirtualMachineImages", "2020-12-01"), + new Tuple("Compute", "VirtualMachineImagesEdgeZone", "2020-12-01"), + new Tuple("Compute", "VirtualMachineRunCommands", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetExtensions", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetRollingUpgrades", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMExtensions", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMs", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSets", "2020-12-01"), + new Tuple("Compute", "VirtualMachineSizes", "2020-12-01"), + new Tuple("Compute", "VirtualMachines", "2020-12-01"), + new Tuple("ContainerService", "ContainerServices", "2017-01-31"), + }.AsEnumerable(); + } + } + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperations.cs new file mode 100644 index 0000000000000..409b39892dba7 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleriesOperationsExtensions.cs new file mode 100644 index 0000000000000..fbc46821ac944 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperations.cs new file mode 100644 index 0000000000000..f86e48b89e023 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImageVersionsOperationsExtensions.cs new file mode 100644 index 0000000000000..30ce93c9da327 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperations.cs new file mode 100644 index 0000000000000..e6d129ddf34db --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SharedGalleryImagesOperationsExtensions.cs new file mode 100644 index 0000000000000..6f7b97ca6e915 --- /dev/null +++ b/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/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs new file mode 100644 index 0000000000000..27074f3deee3f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs @@ -0,0 +1,2112 @@ +// +// 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; + + /// + /// SnapshotsOperations operations. + /// + internal partial class SnapshotsOperations : IServiceOperations, ISnapshotsOperations + { + /// + /// Initializes a new instance of the SnapshotsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SnapshotsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 snapshotName, 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 (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + string apiVersion = "2020-06-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("snapshotName", snapshotName); + 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/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + 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; + } + + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, snapshotName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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"); + } + string apiVersion = "2020-06-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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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/snapshots").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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; + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-06-30"; + // 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, "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/snapshots").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; + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, grantAccessData, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, 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 (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + if (snapshot == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshot"); + } + if (snapshot != null) + { + snapshot.Validate(); + } + string apiVersion = "2020-06-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("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("snapshot", snapshot); + 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/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + 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(snapshot != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(snapshot, 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; + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, 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 (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + if (snapshot == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshot"); + } + string apiVersion = "2020-06-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("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("snapshot", snapshot); + 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/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + 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(snapshot != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(snapshot, 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; + } + + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 snapshotName, 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 (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + string apiVersion = "2020-06-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("snapshotName", snapshotName); + 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/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + 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; + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// 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> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, 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 (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + if (grantAccessData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "grantAccessData"); + } + if (grantAccessData != null) + { + grantAccessData.Validate(); + } + string apiVersion = "2020-06-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("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("grantAccessData", grantAccessData); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGrantAccess", 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/snapshots/{snapshotName}/beginGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + 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(grantAccessData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(grantAccessData, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// 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 BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, 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 (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + string apiVersion = "2020-06-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("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevokeAccess", 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/snapshots/{snapshotName}/endGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + 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; + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperationsExtensions.cs new file mode 100644 index 0000000000000..4cce547c6cc3f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperationsExtensions.cs @@ -0,0 +1,667 @@ +// +// 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 SnapshotsOperations. + /// + public static partial class SnapshotsOperationsExtensions + { + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + public static Snapshot CreateOrUpdate(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot) + { + return operations.CreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + public static Snapshot Update(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot) + { + return operations.UpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + public static Snapshot Get(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + return operations.GetAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + public static void Delete(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.DeleteAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this ISnapshotsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISnapshotsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISnapshotsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISnapshotsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + public static AccessUri GrantAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData) + { + return operations.GrantAccessAsync(resourceGroupName, snapshotName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task GrantAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GrantAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + public static void RevokeAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.RevokeAccessAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task RevokeAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RevokeAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + public static Snapshot BeginCreateOrUpdate(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + public static Snapshot BeginUpdate(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot) + { + return operations.BeginUpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + public static void BeginDelete(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.BeginDeleteAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + public static AccessUri BeginGrantAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData) + { + return operations.BeginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginGrantAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + public static void BeginRevokeAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.BeginRevokeAccessAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9 and _. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevokeAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISnapshotsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISnapshotsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// 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 ISnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperations.cs new file mode 100644 index 0000000000000..9897a18878eb1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperations.cs @@ -0,0 +1,1767 @@ +// +// 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; + + /// + /// SshPublicKeysOperations operations. + /// + internal partial class SshPublicKeysOperations : IServiceOperations, ISshPublicKeysOperations + { + /// + /// Initializes a new instance of the SshPublicKeysOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SshPublicKeysOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys").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; + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The 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>> ListByResourceGroupWithHttpMessagesAsync(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-12-01"; + // 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, "ListByResourceGroup", 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/sshPublicKeys").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; + } + + /// + /// Creates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _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; + } + + /// + /// Updates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _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; + } + + /// + /// Delete an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _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 != 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; + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// 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 sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + 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/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _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; + } + + /// + /// Generates and returns a public/private key pair and populates the SSH + /// public key resource with the public key. The length of the key will be 3072 + /// bits. This operation can only be performed once per SSH public key + /// resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// 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> GenerateKeyPairWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GenerateKeyPair", 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/sshPublicKeys/{sshPublicKeyName}/generateKeyPair").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _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) + { + 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; + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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; + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperationsExtensions.cs new file mode 100644 index 0000000000000..e2f5a40ebee06 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperationsExtensions.cs @@ -0,0 +1,378 @@ +// +// 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 SshPublicKeysOperations. + /// + public static partial class SshPublicKeysOperationsExtensions + { + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this ISshPublicKeysOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ISshPublicKeysOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this ISshPublicKeysOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISshPublicKeysOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + public static SshPublicKeyResource Create(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters) + { + return operations.CreateAsync(resourceGroupName, sshPublicKeyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + public static SshPublicKeyResource Update(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateResource parameters) + { + return operations.UpdateAsync(resourceGroupName, sshPublicKeyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + public static void Delete(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName) + { + operations.DeleteAsync(resourceGroupName, sshPublicKeyName).GetAwaiter().GetResult(); + } + + /// + /// Delete an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + public static SshPublicKeyResource Get(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName) + { + return operations.GetAsync(resourceGroupName, sshPublicKeyName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Generates and returns a public/private key pair and populates the SSH + /// public key resource with the public key. The length of the key will be 3072 + /// bits. This operation can only be performed once per SSH public key + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + public static SshPublicKeyGenerateKeyPairResult GenerateKeyPair(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName) + { + return operations.GenerateKeyPairAsync(resourceGroupName, sshPublicKeyName).GetAwaiter().GetResult(); + } + + /// + /// Generates and returns a public/private key pair and populates the SSH + /// public key resource with the public key. The length of the key will be 3072 + /// bits. This operation can only be performed once per SSH public key + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task GenerateKeyPairAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateKeyPairWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ISshPublicKeysOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ISshPublicKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISshPublicKeysOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISshPublicKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs new file mode 100644 index 0000000000000..e0c198b712e83 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs @@ -0,0 +1,423 @@ +// +// 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; + + /// + /// UsageOperations operations. + /// + internal partial class UsageOperations : IServiceOperations, IUsageOperations + { + /// + /// Initializes a new instance of the UsageOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal UsageOperations(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, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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("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}/usages").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperationsExtensions.cs new file mode 100644 index 0000000000000..39b3384749f18 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperationsExtensions.cs @@ -0,0 +1,101 @@ +// +// 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 UsageOperations. + /// + public static partial class UsageOperationsExtensions + { + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + public static IPage List(this IUsageOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IUsageOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IUsageOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// 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 IUsageOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs new file mode 100644 index 0000000000000..214564a54e88a --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs @@ -0,0 +1,670 @@ +// +// 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 Microsoft.Rest.Azure.OData; + 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; + + /// + /// VirtualMachineExtensionImagesOperations operations. + /// + internal partial class VirtualMachineExtensionImagesOperations : IServiceOperations, IVirtualMachineExtensionImagesOperations + { + /// + /// Initializes a new instance of the VirtualMachineExtensionImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineExtensionImagesOperations(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 virtual machine extension image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + /// + /// 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 publisherName, string type, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "type"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("type", type); + tracingParameters.Add("version", version); + 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}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _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 virtual machine extension image types. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// 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>> ListTypesWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListTypes", 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}/publishers/{publisherName}/artifacttypes/vmextension/types").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _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 virtual machine extension image versions. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the 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>> ListVersionsWithHttpMessagesAsync(string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "type"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("type", type); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListVersions", 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}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + 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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperationsExtensions.cs new file mode 100644 index 0000000000000..8677d2b14eaae --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperationsExtensions.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 Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineExtensionImagesOperations. + /// + public static partial class VirtualMachineExtensionImagesOperationsExtensions + { + /// + /// Gets a virtual machine extension image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + public static VirtualMachineExtensionImage Get(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, string version) + { + return operations.GetAsync(location, publisherName, type, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine extension image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publisherName, type, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine extension image types. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + public static IList ListTypes(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName) + { + return operations.ListTypesAsync(location, publisherName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine extension image types. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> ListTypesAsync(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListTypesWithHttpMessagesAsync(location, publisherName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine extension image versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the operation. + /// + public static IList ListVersions(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListVersionsAsync(location, publisherName, type, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine extension image versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListVersionsAsync(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVersionsWithHttpMessagesAsync(location, publisherName, type, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs new file mode 100644 index 0000000000000..8e20e220f5350 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs @@ -0,0 +1,1188 @@ +// +// 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; + + /// + /// VirtualMachineExtensionsOperations operations. + /// + internal partial class VirtualMachineExtensionsOperations : IServiceOperations, IVirtualMachineExtensionsOperations + { + /// + /// Initializes a new instance of the VirtualMachineExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineExtensionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("expand", expand); + 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/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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; + } + + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the 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> ListWithHttpMessagesAsync(string resourceGroupName, string vmName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("expand", expand); + 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/virtualMachines/{vmName}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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; + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (extensionParameters != null) + { + extensionParameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _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(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, 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; + } + + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _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(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, 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; + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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 vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + 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/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperationsExtensions.cs new file mode 100644 index 0000000000000..c63a4d94c60e7 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperationsExtensions.cs @@ -0,0 +1,421 @@ +// +// 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 VirtualMachineExtensionsOperations. + /// + public static partial class VirtualMachineExtensionsOperationsExtensions + { + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineExtension CreateOrUpdate(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineExtension Update(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + { + return operations.UpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + public static void Delete(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName) + { + operations.DeleteAsync(resourceGroupName, vmName, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineExtension Get(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmName, vmExtensionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineExtensionsListResult List(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string expand = default(string)) + { + return operations.ListAsync(resourceGroupName, vmName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineExtension BeginCreateOrUpdate(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineExtension BeginUpdate(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + public static void BeginDelete(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName) + { + operations.BeginDeleteAsync(resourceGroupName, vmName, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperations.cs new file mode 100644 index 0000000000000..b4f675fffcaff --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperations.cs @@ -0,0 +1,1143 @@ +// +// 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; + + /// + /// VirtualMachineImagesEdgeZoneOperations operations. + /// + internal partial class VirtualMachineImagesEdgeZoneOperations : IServiceOperations, IVirtualMachineImagesEdgeZoneOperations + { + /// + /// Initializes a new instance of the VirtualMachineImagesEdgeZoneOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineImagesEdgeZoneOperations(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 virtual machine image in an edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("version", version); + 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}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _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 virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("expand", expand); + tracingParameters.Add("top", top); + tracingParameters.Add("orderby", orderby); + 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}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + 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 virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// 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>> ListOffersWithHttpMessagesAsync(string location, string edgeZone, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOffers", 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}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _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 virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// 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>> ListPublishersWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPublishers", 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}/edgeZones/{edgeZone}/publishers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _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 virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", 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}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs new file mode 100644 index 0000000000000..b7c0df8deb58f --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs @@ -0,0 +1,315 @@ +// +// 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 VirtualMachineImagesEdgeZoneOperations. + /// + public static partial class VirtualMachineImagesEdgeZoneOperationsExtensions + { + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + public static VirtualMachineImage Get(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string version) + { + return operations.GetAsync(location, edgeZone, publisherName, offer, skus, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, edgeZone, publisherName, offer, skus, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + public static IList List(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string)) + { + return operations.ListAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + public static IList ListOffers(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName) + { + return operations.ListOffersAsync(location, edgeZone, publisherName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOffersAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOffersWithHttpMessagesAsync(location, edgeZone, publisherName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + public static IList ListPublishers(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone) + { + return operations.ListPublishersAsync(location, edgeZone).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPublishersAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPublishersWithHttpMessagesAsync(location, edgeZone, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + public static IList ListSkus(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer) + { + return operations.ListSkusAsync(location, edgeZone, publisherName, offer).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(location, edgeZone, publisherName, offer, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs new file mode 100644 index 0000000000000..c5580e85ffac1 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs @@ -0,0 +1,1095 @@ +// +// 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; + + /// + /// VirtualMachineImagesOperations operations. + /// + internal partial class VirtualMachineImagesOperations : IServiceOperations, IVirtualMachineImagesOperations + { + /// + /// Initializes a new instance of the VirtualMachineImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineImagesOperations(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 virtual machine image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// 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 publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("version", version); + 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}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _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 virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the 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>> ListWithHttpMessagesAsync(string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("expand", expand); + tracingParameters.Add("top", top); + tracingParameters.Add("orderby", orderby); + 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}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + 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 virtual machine image offers for the specified location and + /// publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// 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>> ListOffersWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOffers", 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}/publishers/{publisherName}/artifacttypes/vmimage/offers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _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 virtual machine image publishers for the specified Azure + /// location. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// 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>> ListPublishersWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPublishers", 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}/publishers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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 virtual machine image SKUs for the specified location, + /// publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string location, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", 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}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperationsExtensions.cs new file mode 100644 index 0000000000000..2ffb198f4ff50 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperationsExtensions.cs @@ -0,0 +1,279 @@ +// +// 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 VirtualMachineImagesOperations. + /// + public static partial class VirtualMachineImagesOperationsExtensions + { + /// + /// Gets a virtual machine image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + public static VirtualMachineImage Get(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string version) + { + return operations.GetAsync(location, publisherName, offer, skus, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publisherName, offer, skus, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// + /// + /// + public static IList List(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string)) + { + return operations.ListAsync(location, publisherName, offer, skus, expand, top, orderby).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, publisherName, offer, skus, expand, top, orderby, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image offers for the specified location and + /// publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + public static IList ListOffers(this IVirtualMachineImagesOperations operations, string location, string publisherName) + { + return operations.ListOffersAsync(location, publisherName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image offers for the specified location and + /// publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOffersAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOffersWithHttpMessagesAsync(location, publisherName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + public static IList ListPublishers(this IVirtualMachineImagesOperations operations, string location) + { + return operations.ListPublishersAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPublishersAsync(this IVirtualMachineImagesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPublishersWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, + /// publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + public static IList ListSkus(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer) + { + return operations.ListSkusAsync(location, publisherName, offer).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, + /// publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(location, publisherName, offer, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs new file mode 100644 index 0000000000000..5e21431af62e4 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs @@ -0,0 +1,620 @@ +// +// 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; + + /// + /// VirtualMachineRunCommandsOperations operations. + /// + internal partial class VirtualMachineRunCommandsOperations : IServiceOperations, IVirtualMachineRunCommandsOperations + { + /// + /// Initializes a new instance of the VirtualMachineRunCommandsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineRunCommandsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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("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}/runCommands").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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 specific run command for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + /// + /// 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 commandId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (commandId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "commandId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("commandId", commandId); + 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}/runCommands/{commandId}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{commandId}", System.Uri.EscapeDataString(commandId)); + _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; + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperationsExtensions.cs new file mode 100644 index 0000000000000..82323d777a957 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperationsExtensions.cs @@ -0,0 +1,133 @@ +// +// 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 VirtualMachineRunCommandsOperations. + /// + public static partial class VirtualMachineRunCommandsOperationsExtensions + { + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + public static IPage List(this IVirtualMachineRunCommandsOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineRunCommandsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + public static RunCommandDocument Get(this IVirtualMachineRunCommandsOperations operations, string location, string commandId) + { + return operations.GetAsync(location, commandId).GetAwaiter().GetResult(); + } + + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineRunCommandsOperations operations, string location, string commandId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, commandId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineRunCommandsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// 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 IVirtualMachineRunCommandsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs new file mode 100644 index 0000000000000..597afb7122f8c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs @@ -0,0 +1,1367 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetExtensionsOperations operations. + /// + internal partial class VirtualMachineScaleSetExtensionsOperations : IServiceOperations, IVirtualMachineScaleSetExtensionsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + tracingParameters.Add("expand", expand); + 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/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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 extensions in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// 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 vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + 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/virtualMachineScaleSets/{vmScaleSetName}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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; + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _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(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, 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; + } + + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _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(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, 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; + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// 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 vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + 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/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _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; + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperationsExtensions.cs new file mode 100644 index 0000000000000..b654ec5c3eb3c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperationsExtensions.cs @@ -0,0 +1,449 @@ +// +// 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 VirtualMachineScaleSetExtensionsOperations. + /// + public static partial class VirtualMachineScaleSetExtensionsOperationsExtensions + { + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension CreateOrUpdate(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension Update(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + public static void Delete(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineScaleSetExtension Get(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + public static IPage List(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.ListAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension BeginCreateOrUpdate(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension BeginUpdate(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + public static void BeginDelete(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineScaleSetExtensionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// 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 IVirtualMachineScaleSetExtensionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs new file mode 100644 index 0000000000000..6ad75c560b4cf --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs @@ -0,0 +1,841 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetRollingUpgradesOperations operations. + /// + internal partial class VirtualMachineScaleSetRollingUpgradesOperations : IServiceOperations, IVirtualMachineScaleSetRollingUpgradesOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetRollingUpgradesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCancelWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartOSUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a rolling upgrade to move all extensions for all virtual machine + /// scale set instances to the latest available extension version. Instances + /// which are already running the latest extension versions are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartExtensionUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of the latest virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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> GetLatestWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetLatest", 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/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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; + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 BeginCancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCancel", 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/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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; + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 BeginStartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartOSUpgrade", 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/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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; + } + + /// + /// Starts a rolling upgrade to move all extensions for all virtual machine + /// scale set instances to the latest available extension version. Instances + /// which are already running the latest extension versions are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 BeginStartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartExtensionUpgrade", 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/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperationsExtensions.cs new file mode 100644 index 0000000000000..8bcea9e3f7659 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperationsExtensions.cs @@ -0,0 +1,303 @@ +// +// 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 VirtualMachineScaleSetRollingUpgradesOperations. + /// + public static partial class VirtualMachineScaleSetRollingUpgradesOperationsExtensions + { + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void Cancel(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.CancelAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void StartOSUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.StartOSUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task StartOSUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartOSUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a rolling upgrade to move all extensions for all virtual machine + /// scale set instances to the latest available extension version. Instances + /// which are already running the latest extension versions are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void StartExtensionUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.StartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Starts a rolling upgrade to move all extensions for all virtual machine + /// scale set instances to the latest available extension version. Instances + /// which are already running the latest extension versions are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task StartExtensionUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartExtensionUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the status of the latest virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static RollingUpgradeStatusInfo GetLatest(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.GetLatestAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of the latest virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task GetLatestAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetLatestWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void BeginCancel(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.BeginCancelAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCancelAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCancelWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void BeginStartOSUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.BeginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartOSUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartOSUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a rolling upgrade to move all extensions for all virtual machine + /// scale set instances to the latest available extension version. Instances + /// which are already running the latest extension versions are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void BeginStartExtensionUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.BeginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Starts a rolling upgrade to move all extensions for all virtual machine + /// scale set instances to the latest available extension version. Instances + /// which are already running the latest extension versions are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartExtensionUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartExtensionUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs new file mode 100644 index 0000000000000..a8fc18d075292 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs @@ -0,0 +1,1241 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetVMExtensionsOperations operations. + /// + internal partial class VirtualMachineScaleSetVMExtensionsOperations : IServiceOperations, IVirtualMachineScaleSetVMExtensionsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("expand", expand); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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; + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the 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> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("expand", expand); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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; + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (extensionParameters != null) + { + extensionParameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _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(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, 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; + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _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(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, 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; + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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 vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs new file mode 100644 index 0000000000000..be93828f83676 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs @@ -0,0 +1,467 @@ +// +// 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 VirtualMachineScaleSetVMExtensionsOperations. + /// + public static partial class VirtualMachineScaleSetVMExtensionsOperationsExtensions + { + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// 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)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// 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)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// 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)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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)) + { + return operations.ListAsync(resourceGroupName, vmScaleSetName, instanceId, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// 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)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// 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)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// 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) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// 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)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + public static void BeginDelete(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs new file mode 100644 index 0000000000000..496e00e7def5c --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs @@ -0,0 +1,3703 @@ +// +// 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 Microsoft.Rest.Azure.OData; + 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; + + /// + /// VirtualMachineScaleSetVMsOperations operations. + /// + internal partial class VirtualMachineScaleSetVMsOperations : IServiceOperations, IVirtualMachineScaleSetVMsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on 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 resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("expand", expand); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + 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 virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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 virtual machines in a VM scale sets. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + /// + /// 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 virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualMachineScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("virtualMachineScaleSetName", virtualMachineScaleSetName); + tracingParameters.Add("select", select); + 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/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualMachineScaleSetName}", System.Uri.EscapeDataString(virtualMachineScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + 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; + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a virtual + /// machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be + /// generated with a default expiration duration of 120 minutes. + /// + /// + /// 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> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("sasUriExpirationTimeInMinutes", sasUriExpirationTimeInMinutes); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RetrieveBootDiagnosticsData", 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (sasUriExpirationTimeInMinutes != null) + { + _queryParameters.Add(string.Format("sasUriExpirationTimeInMinutes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sasUriExpirationTimeInMinutes, Client.SerializationSettings).Trim('"')))); + } + 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) + { + 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; + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to simulate the eviction of spot virtual machine in a VM + /// scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SimulateEviction", 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/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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 != 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; + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters); + if (tempDisk != null) + { + vmScaleSetVMReimageInput = new VirtualMachineScaleSetVMReimageParameters(); + vmScaleSetVMReimageInput.TempDisk = tempDisk; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmScaleSetVMReimageInput", vmScaleSetVMReimageInput); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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(vmScaleSetVMReimageInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmScaleSetVMReimageInput, 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; + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimageAll", 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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; + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeallocate", 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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; + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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(); + } + // 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; + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("forceDeletion", forceDeletion); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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))); + } + 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; + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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 vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("skipShutdown", skipShutdown); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (skipShutdown != null) + { + _queryParameters.Add(string.Format("skipShutdown={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skipShutdown, Client.SerializationSettings).Trim('"')))); + } + 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 a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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; + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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; + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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; + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// 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 BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPerformMaintenance", 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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; + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command 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> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRunCommand", 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/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _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(); + } + // 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 virtual machines in a VM scale sets. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs new file mode 100644 index 0000000000000..888c670a294fa --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs @@ -0,0 +1,1391 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetVMsOperations. + /// + public static partial class VirtualMachineScaleSetVMsOperationsExtensions + { + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + public static void Reimage(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk = default(bool?)) + { + operations.ReimageAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void ReimageAll(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.ReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAllAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Deallocate(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.DeallocateAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task DeallocateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + public static VirtualMachineScaleSetVM Update(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + public static void Delete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?)) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'instanceView' + /// + public static VirtualMachineScaleSetVM Get(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, instanceId, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the status of a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static VirtualMachineScaleSetVMInstanceView GetInstanceView(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + return operations.GetInstanceViewAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + public static IPage List(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string)) + { + return operations.ListAsync(resourceGroupName, virtualMachineScaleSetName, odataQuery, select).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, virtualMachineScaleSetName, odataQuery, select, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void PowerOff(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false) + { + operations.PowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Restart(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.RestartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Start(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.StartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Redeploy(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.RedeployAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a virtual + /// machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be + /// generated with a default expiration duration of 120 minutes. + /// + public static RetrieveBootDiagnosticsDataResult RetrieveBootDiagnosticsData(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?)) + { + return operations.RetrieveBootDiagnosticsDataAsync(resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes).GetAwaiter().GetResult(); + } + + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a virtual + /// machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be + /// generated with a default expiration duration of 120 minutes. + /// + /// + /// The cancellation token. + /// + public static async Task RetrieveBootDiagnosticsDataAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RetrieveBootDiagnosticsDataWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void PerformMaintenance(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.PerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task PerformMaintenanceAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void SimulateEviction(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.SimulateEvictionAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task SimulateEvictionAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SimulateEvictionWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult RunCommand(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters) + { + return operations.RunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task RunCommandAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RunCommandWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + public static void BeginReimage(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk = default(bool?)) + { + operations.BeginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginReimageAll(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAllAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginDeallocate(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeallocateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + public static VirtualMachineScaleSetVM BeginUpdate(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + public static void BeginDelete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void BeginPowerOff(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false) + { + operations.BeginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginRestart(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginRestartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginStart(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginStartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginRedeploy(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginPerformMaintenance(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPerformMaintenanceAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult BeginRunCommand(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters) + { + return operations.BeginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRunCommandAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineScaleSetVMsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// 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 IVirtualMachineScaleSetVMsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs new file mode 100644 index 0000000000000..b0287372faf8b --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs @@ -0,0 +1,5780 @@ +// +// 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; + + /// + /// VirtualMachineScaleSetsOperations operations. + /// + internal partial class VirtualMachineScaleSetsOperations : IServiceOperations, IVirtualMachineScaleSetsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetsOperations(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 all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", 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}/virtualMachineScaleSets").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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; + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + 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/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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; + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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 vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + 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/virtualMachineScaleSets/{vmScaleSetName}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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 VM scale sets under a resource group. + /// + /// + /// The 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-12-01"; + // 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/virtualMachineScaleSets").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; + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// 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-12-01"; + // 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/virtualMachineScaleSets").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 SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", 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/virtualMachineScaleSets/{vmScaleSetName}/skus").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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 list of OS upgrades on a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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>> GetOSUpgradeHistoryWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOSUpgradeHistory", 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/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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; + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task UpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUpdateInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Manual platform update domain walk to update virtual machines in a service + /// fabric virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is requested + /// + /// + /// 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> ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("platformUpdateDomain", platformUpdateDomain); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", 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/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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))); + } + _queryParameters.Add(string.Format("platformUpdateDomain={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(platformUpdateDomain, 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("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) + { + 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; + } + + /// + /// Converts SinglePlacementGroup property to false for a existing virtual + /// machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use Virtual + /// Machine Scale Set VMs - Get API. If not provided, the platform will choose + /// one with maximum number of virtual machine instances. + /// + /// + /// 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 ConvertToSinglePlacementGroupWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VMScaleSetConvertToSinglePlacementGroupInput parameters = new VMScaleSetConvertToSinglePlacementGroupInput(); + if (activePlacementGroupId != null) + { + parameters.ActivePlacementGroupId = activePlacementGroupId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ConvertToSinglePlacementGroup", 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/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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) + { + 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; + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task SetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginSetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set 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 vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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 VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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 VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// 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 vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("forceDeletion", forceDeletion); + 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/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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))); + } + 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; + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeallocate", 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/virtualMachineScaleSets/{vmScaleSetName}/deallocate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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 virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// 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 vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (instanceIds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); + if (instanceIds != null) + { + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("forceDeletion", forceDeletion); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + 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/virtualMachineScaleSets/{vmScaleSetName}/delete").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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))); + } + 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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("skipShutdown", skipShutdown); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + 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/virtualMachineScaleSets/{vmScaleSetName}/poweroff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (skipShutdown != null) + { + _queryParameters.Add(string.Format("skipShutdown={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skipShutdown, Client.SerializationSettings).Trim('"')))); + } + 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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + 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/virtualMachineScaleSets/{vmScaleSetName}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// 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 vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + 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/virtualMachineScaleSets/{vmScaleSetName}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", 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/virtualMachineScaleSets/{vmScaleSetName}/redeploy").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPerformMaintenance", 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/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// 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 BeginUpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (instanceIds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); + if (instanceIds != null) + { + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateInstances", 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/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// 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 vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmScaleSetReimageInput", vmScaleSetReimageInput); + 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/virtualMachineScaleSets/{vmScaleSetName}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmScaleSetReimageInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmScaleSetReimageInput, 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; + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// 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 BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimageAll", 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/virtualMachineScaleSets/{vmScaleSetName}/reimageall").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, 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; + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// 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 BeginSetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginSetOrchestrationServiceState", 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/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _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 all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(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, "ListByLocationNext", 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 VM scale sets under a resource group. + /// + /// + /// 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; + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// 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 SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// 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>> ListSkusNextWithHttpMessagesAsync(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, "ListSkusNext", 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 list of OS upgrades on a VM scale set instance. + /// + /// + /// 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>> GetOSUpgradeHistoryNextWithHttpMessagesAsync(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, "GetOSUpgradeHistoryNext", 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/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs new file mode 100644 index 0000000000000..ae311ab9e0c50 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs @@ -0,0 +1,1928 @@ +// +// 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 VirtualMachineScaleSetsOperations. + /// + public static partial class VirtualMachineScaleSetsOperationsExtensions + { + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + public static IPage ListByLocation(this IVirtualMachineScaleSetsOperations operations, string location) + { + return operations.ListByLocationAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IVirtualMachineScaleSetsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet CreateOrUpdate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet Update(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + public static void Delete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?)) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static VirtualMachineScaleSet Get(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void Deallocate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.DeallocateAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task DeallocateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + public static void DeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?)) + { + operations.DeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static VirtualMachineScaleSetInstanceView GetInstanceView(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.GetInstanceViewAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage List(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListAll(this IVirtualMachineScaleSetsOperations operations) + { + return operations.ListAllAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this IVirtualMachineScaleSetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static IPage ListSkus(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.ListSkusAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static IPage GetOSUpgradeHistory(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.GetOSUpgradeHistoryAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task> GetOSUpgradeHistoryAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOSUpgradeHistoryWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void PowerOff(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList)) + { + operations.PowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void Restart(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.RestartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void Start(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.StartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void Redeploy(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.RedeployAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void PerformMaintenance(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.PerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task PerformMaintenanceAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + public static void UpdateInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds) + { + operations.UpdateInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + public static void Reimage(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters)) + { + operations.ReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void ReimageAll(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.ReimageAllAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAllAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Manual platform update domain walk to update virtual machines in a service + /// fabric virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is requested + /// + public static RecoveryWalkResponse ForceRecoveryServiceFabricPlatformUpdateDomainWalk(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, int platformUpdateDomain) + { + return operations.ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync(resourceGroupName, vmScaleSetName, platformUpdateDomain).GetAwaiter().GetResult(); + } + + /// + /// Manual platform update domain walk to update virtual machines in a service + /// fabric virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is requested + /// + /// + /// The cancellation token. + /// + public static async Task ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, platformUpdateDomain, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Converts SinglePlacementGroup property to false for a existing virtual + /// machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use Virtual + /// Machine Scale Set VMs - Get API. If not provided, the platform will choose + /// one with maximum number of virtual machine instances. + /// + public static void ConvertToSinglePlacementGroup(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string)) + { + operations.ConvertToSinglePlacementGroupAsync(resourceGroupName, vmScaleSetName, activePlacementGroupId).GetAwaiter().GetResult(); + } + + /// + /// Converts SinglePlacementGroup property to false for a existing virtual + /// machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use Virtual + /// Machine Scale Set VMs - Get API. If not provided, the platform will choose + /// one with maximum number of virtual machine instances. + /// + /// + /// The cancellation token. + /// + public static async Task ConvertToSinglePlacementGroupAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ConvertToSinglePlacementGroupWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, activePlacementGroupId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + public static void SetOrchestrationServiceState(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters) + { + operations.SetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The cancellation token. + /// + public static async Task SetOrchestrationServiceStateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet BeginCreateOrUpdate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet BeginUpdate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + public static void BeginDelete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void BeginDeallocate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeallocateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + public static void BeginDeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void BeginPowerOff(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList)) + { + operations.BeginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void BeginRestart(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginRestartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void BeginStart(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginStartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void BeginRedeploy(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginRedeployAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void BeginPerformMaintenance(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPerformMaintenanceAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + public static void BeginUpdateInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds) + { + operations.BeginUpdateInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginUpdateInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + public static void BeginReimage(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters)) + { + operations.BeginReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + public static void BeginReimageAll(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. Omitting the virtual machine + /// scale set instance ids will result in the operation being performed on all + /// virtual machines in the virtual machine scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAllAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + public static void BeginSetOrchestrationServiceState(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters) + { + operations.BeginSetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The cancellation token. + /// + public static async Task BeginSetOrchestrationServiceStateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginSetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// 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 IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// 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 IVirtualMachineScaleSetsOperations 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 SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListSkusNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListSkusNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetOSUpgradeHistoryNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.GetOSUpgradeHistoryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetOSUpgradeHistoryNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOSUpgradeHistoryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs new file mode 100644 index 0000000000000..11ae9680fcb11 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.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 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; + + /// + /// VirtualMachineSizesOperations operations. + /// + internal partial class VirtualMachineSizesOperations : IServiceOperations, IVirtualMachineSizesOperations + { + /// + /// Initializes a new instance of the VirtualMachineSizesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineSizesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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("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}/vmSizes").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperationsExtensions.cs new file mode 100644 index 0000000000000..64554b65694ae --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperationsExtensions.cs @@ -0,0 +1,63 @@ +// +// 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 VirtualMachineSizesOperations. + /// + public static partial class VirtualMachineSizesOperationsExtensions + { + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static IEnumerable List(this IVirtualMachineSizesOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineSizesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs new file mode 100644 index 0000000000000..e722b9908b881 --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs @@ -0,0 +1,5721 @@ +// +// 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; + + /// + /// VirtualMachinesOperations operations. + /// + internal partial class VirtualMachinesOperations : IServiceOperations, IVirtualMachinesOperations + { + /// + /// Initializes a new instance of the VirtualMachinesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachinesOperations(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 all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", 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}/virtualMachines").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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; + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCaptureWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + 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, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about the model view or the instance view of a + /// virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on 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 resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("expand", expand); + 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/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Retrieves information about the run-time state of a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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> InstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "InstanceView", 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/virtualMachines/{vmName}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginConvertToManagedDisksWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the OS state of the virtual machine to generalized. It is recommended + /// to sysprep the virtual machine before performing this operation. + /// <br>For Windows, please refer to [Create a managed image of a + /// generalized VM in + /// Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For + /// Linux, please refer to [How to create an image of a virtual machine or + /// VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 GeneralizeWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Generalize", 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/virtualMachines/{vmName}/generalize").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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) + { + 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; + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The 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-12-01"; + // 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/virtualMachines").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; + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// + /// + /// 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(string statusOnly = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statusOnly", statusOnly); + 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/virtualMachines").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 (statusOnly != null) + { + _queryParameters.Add(string.Format("statusOnly={0}", System.Uri.EscapeDataString(statusOnly))); + } + 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; + } + + /// + /// Lists all available virtual machine sizes to which the specified virtual + /// machine can be resized. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAvailableSizes", 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/virtualMachines/{vmName}/vmSizes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to its + /// initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmName, tempDisk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot diagnostic + /// logs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be + /// generated with a default expiration duration of 120 minutes. + /// + /// + /// 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> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("sasUriExpirationTimeInMinutes", sasUriExpirationTimeInMinutes); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RetrieveBootDiagnosticsData", 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/virtualMachines/{vmName}/retrieveBootDiagnosticsData").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (sasUriExpirationTimeInMinutes != null) + { + _queryParameters.Add(string.Format("sasUriExpirationTimeInMinutes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sasUriExpirationTimeInMinutes, Client.SerializationSettings).Trim('"')))); + } + 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) + { + 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 operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SimulateEviction", 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/virtualMachines/{vmName}/simulateEviction").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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 != 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; + } + + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> AssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAssessPatchesWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> InstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine 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> BeginCaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCapture", 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/virtualMachines/{vmName}/capture").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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(); + } + // 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 operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// + /// + /// 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 vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + 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); + } + // 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/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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))); + } + 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; + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginConvertToManagedDisks", 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/virtualMachines/{vmName}/convertToManagedDisks").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeallocate", 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/virtualMachines/{vmName}/deallocate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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 operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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 vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("skipShutdown", skipShutdown); + 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/virtualMachines/{vmName}/powerOff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (skipShutdown != null) + { + _queryParameters.Add(string.Format("skipShutdown={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skipShutdown, Client.SerializationSettings).Trim('"')))); + } + 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 operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReapply", 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/virtualMachines/{vmName}/reapply").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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 operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + 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/virtualMachines/{vmName}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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 operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + 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/virtualMachines/{vmName}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", 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/virtualMachines/{vmName}/redeploy").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to its + /// initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// 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 vmName, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters); + if (tempDisk != null) + { + parameters = new VirtualMachineReimageParameters(); + parameters.TempDisk = tempDisk; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + 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/virtualMachines/{vmName}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPerformMaintenance", 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/virtualMachines/{vmName}/performMaintenance").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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; + } + + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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> BeginAssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginAssessPatches", 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/virtualMachines/{vmName}/assessPatches").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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(); + } + // 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; + } + + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// 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> BeginInstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (installPatchesInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "installPatchesInput"); + } + if (installPatchesInput != null) + { + installPatchesInput.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("installPatchesInput", installPatchesInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginInstallPatches", 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/virtualMachines/{vmName}/installPatches").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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(installPatchesInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(installPatchesInput, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command 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> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRunCommand", 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/virtualMachines/{vmName}/runCommand").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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(); + } + // 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 all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(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, "ListByLocationNext", 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; + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// 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; + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// 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; + } + + } +} diff --git a/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs new file mode 100644 index 0000000000000..1c7bc104a93cf --- /dev/null +++ b/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs @@ -0,0 +1,1879 @@ +// +// 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 VirtualMachinesOperations. + /// + public static partial class VirtualMachinesOperationsExtensions + { + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// + public static IPage ListByLocation(this IVirtualMachinesOperations operations, string location) + { + return operations.ListByLocationAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IVirtualMachinesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + public static VirtualMachineCaptureResult Capture(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters) + { + return operations.CaptureAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task CaptureAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CaptureWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + public static VirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + public static VirtualMachine Update(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// + public static void Delete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?)) + { + operations.DeleteAsync(resourceGroupName, vmName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// + /// + /// The cancellation token. + /// + 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, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about the model view or the instance view of a + /// virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'instanceView' + /// + public static VirtualMachine Get(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, vmName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about the model view or the instance view of a + /// virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about the run-time state of a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static VirtualMachineInstanceView InstanceView(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.InstanceViewAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about the run-time state of a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task InstanceViewAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InstanceViewWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void ConvertToManagedDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.ConvertToManagedDisksAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ConvertToManagedDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ConvertToManagedDisksWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Deallocate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.DeallocateAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task DeallocateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeallocateWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Sets the OS state of the virtual machine to generalized. It is recommended + /// to sysprep the virtual machine before performing this operation. + /// <br>For Windows, please refer to [Create a managed image of a + /// generalized VM in + /// Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For + /// Linux, please refer to [How to create an image of a virtual machine or + /// VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Generalize(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.GeneralizeAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Sets the OS state of the virtual machine to generalized. It is recommended + /// to sysprep the virtual machine before performing this operation. + /// <br>For Windows, please refer to [Create a managed image of a + /// generalized VM in + /// Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For + /// Linux, please refer to [How to create an image of a virtual machine or + /// VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task GeneralizeAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.GeneralizeWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage List(this IVirtualMachinesOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachinesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// + public static IPage ListAll(this IVirtualMachinesOperations operations, string statusOnly = default(string)) + { + return operations.ListAllAsync(statusOnly).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this IVirtualMachinesOperations operations, string statusOnly = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(statusOnly, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all available virtual machine sizes to which the specified virtual + /// machine can be resized. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static IEnumerable ListAvailableSizes(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.ListAvailableSizesAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Lists all available virtual machine sizes to which the specified virtual + /// machine can be resized. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAvailableSizesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAvailableSizesWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void PowerOff(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false) + { + operations.PowerOffAsync(resourceGroupName, vmName, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Reapply(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.ReapplyAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ReapplyAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReapplyWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Restart(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.RestartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Start(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.StartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Redeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.RedeployAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to its + /// initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + public static void Reimage(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk = default(bool?)) + { + operations.ReimageAsync(resourceGroupName, vmName, tempDisk).GetAwaiter().GetResult(); + } + + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to its + /// initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmName, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot diagnostic + /// logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be + /// generated with a default expiration duration of 120 minutes. + /// + public static RetrieveBootDiagnosticsDataResult RetrieveBootDiagnosticsData(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?)) + { + return operations.RetrieveBootDiagnosticsDataAsync(resourceGroupName, vmName, sasUriExpirationTimeInMinutes).GetAwaiter().GetResult(); + } + + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot diagnostic + /// logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be + /// generated with a default expiration duration of 120 minutes. + /// + /// + /// The cancellation token. + /// + public static async Task RetrieveBootDiagnosticsDataAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RetrieveBootDiagnosticsDataWithHttpMessagesAsync(resourceGroupName, vmName, sasUriExpirationTimeInMinutes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void PerformMaintenance(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.PerformMaintenanceAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task PerformMaintenanceAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void SimulateEviction(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.SimulateEvictionAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task SimulateEvictionAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SimulateEvictionWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static VirtualMachineAssessPatchesResult AssessPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.AssessPatchesAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task AssessPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AssessPatchesWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + public static VirtualMachineInstallPatchesResult InstallPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput) + { + return operations.InstallPatchesAsync(resourceGroupName, vmName, installPatchesInput).GetAwaiter().GetResult(); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The cancellation token. + /// + public static async Task InstallPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult RunCommand(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters) + { + return operations.RunCommandAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task RunCommandAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RunCommandWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + public static VirtualMachineCaptureResult BeginCapture(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters) + { + return operations.BeginCaptureAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCaptureAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCaptureWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + public static VirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + public static VirtualMachine BeginUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// + public static void BeginDelete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteAsync(resourceGroupName, vmName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// + /// + /// The cancellation token. + /// + 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, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginConvertToManagedDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginConvertToManagedDisksAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginConvertToManagedDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginConvertToManagedDisksWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginDeallocate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginDeallocateAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeallocateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void BeginPowerOff(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false) + { + operations.BeginPowerOffAsync(resourceGroupName, vmName, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginReapply(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginReapplyAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReapplyAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginRestart(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginRestartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStart(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginStartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginRedeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginRedeployAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to its + /// initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + public static void BeginReimage(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk = default(bool?)) + { + operations.BeginReimageAsync(resourceGroupName, vmName, tempDisk).GetAwaiter().GetResult(); + } + + /// + /// Reimages the virtual machine which has an ephemeral OS disk back to its + /// initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specifies whether to reimage temp disk. Default value: false. Note: This + /// temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS + /// disk. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmName, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginPerformMaintenance(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginPerformMaintenanceAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPerformMaintenanceAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static VirtualMachineAssessPatchesResult BeginAssessPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.BeginAssessPatchesAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginAssessPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginAssessPatchesWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + public static VirtualMachineInstallPatchesResult BeginInstallPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput) + { + return operations.BeginInstallPatchesAsync(resourceGroupName, vmName, installPatchesInput).GetAwaiter().GetResult(); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The cancellation token. + /// + public static async Task BeginInstallPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginInstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult BeginRunCommand(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters) + { + return operations.BeginRunCommandAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRunCommandAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// 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 IVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// 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 IVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/global.json b/global.json index 13c0deebbbaa2..7da46cc81c348 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "Microsoft.Build.Traversal": "1.0.45" }, "sdk": { - "version": "3.1.301", + "version": "5.0.101", "rollForward": "feature" } } \ No newline at end of file diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs index f2701a2ef0692..a68b33a6ee12d 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs @@ -105,7 +105,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -313,7 +313,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -511,7 +511,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -687,7 +687,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -871,7 +871,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1059,7 +1059,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1252,7 +1252,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 de53f6a7b1932..7fe57d533cfa3 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs @@ -116,6 +116,11 @@ public partial class ComputeManagementClient : ServiceClient public virtual IVirtualMachineImagesOperations VirtualMachineImages { get; private set; } + /// + /// Gets the IVirtualMachineImagesEdgeZoneOperations. + /// + public virtual IVirtualMachineImagesEdgeZoneOperations VirtualMachineImagesEdgeZone { get; private set; } + /// /// Gets the IUsageOperations. /// @@ -126,6 +131,11 @@ public partial class ComputeManagementClient : ServiceClient public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } + /// + /// Gets the IVirtualMachineScaleSetsOperations. + /// + public virtual IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; private set; } + /// /// Gets the IVirtualMachineSizesOperations. /// @@ -136,11 +146,6 @@ public partial class ComputeManagementClient : ServiceClient public virtual IImagesOperations Images { get; private set; } - /// - /// Gets the IVirtualMachineScaleSetsOperations. - /// - public virtual IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; private set; } - /// /// Gets the IVirtualMachineScaleSetExtensionsOperations. /// @@ -221,6 +226,26 @@ 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. /// @@ -476,11 +501,12 @@ private void Initialize() VirtualMachineExtensionImages = new VirtualMachineExtensionImagesOperations(this); VirtualMachineExtensions = new VirtualMachineExtensionsOperations(this); VirtualMachineImages = new VirtualMachineImagesOperations(this); + VirtualMachineImagesEdgeZone = new VirtualMachineImagesEdgeZoneOperations(this); Usage = new UsageOperations(this); VirtualMachines = new VirtualMachinesOperations(this); + VirtualMachineScaleSets = new VirtualMachineScaleSetsOperations(this); VirtualMachineSizes = new VirtualMachineSizesOperations(this); Images = new ImagesOperations(this); - VirtualMachineScaleSets = new VirtualMachineScaleSetsOperations(this); VirtualMachineScaleSetExtensions = new VirtualMachineScaleSetExtensionsOperations(this); VirtualMachineScaleSetRollingUpgrades = new VirtualMachineScaleSetRollingUpgradesOperations(this); VirtualMachineScaleSetVMExtensions = new VirtualMachineScaleSetVMExtensionsOperations(this); @@ -497,6 +523,10 @@ 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); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs index e81752b46337f..076bab87a29d3 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs @@ -107,7 +107,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -333,7 +333,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -531,7 +531,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -712,7 +712,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -906,7 +906,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1086,7 +1086,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs index db530fa653c0e..6bb551e9fc243 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs @@ -186,7 +186,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -389,7 +389,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -601,7 +601,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -836,7 +836,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1043,7 +1043,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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/IComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs index 12145c0f68bca..5035b28856592 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs @@ -111,6 +111,11 @@ public partial interface IComputeManagementClient : System.IDisposable /// IVirtualMachineImagesOperations VirtualMachineImages { get; } + /// + /// Gets the IVirtualMachineImagesEdgeZoneOperations. + /// + IVirtualMachineImagesEdgeZoneOperations VirtualMachineImagesEdgeZone { get; } + /// /// Gets the IUsageOperations. /// @@ -121,6 +126,11 @@ public partial interface IComputeManagementClient : System.IDisposable /// IVirtualMachinesOperations VirtualMachines { get; } + /// + /// Gets the IVirtualMachineScaleSetsOperations. + /// + IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; } + /// /// Gets the IVirtualMachineSizesOperations. /// @@ -131,11 +141,6 @@ public partial interface IComputeManagementClient : System.IDisposable /// IImagesOperations Images { get; } - /// - /// Gets the IVirtualMachineScaleSetsOperations. - /// - IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; } - /// /// Gets the IVirtualMachineScaleSetExtensionsOperations. /// @@ -216,6 +221,26 @@ 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. /// 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/IVirtualMachineImagesEdgeZoneOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesEdgeZoneOperations.cs new file mode 100644 index 0000000000000..3beead36a4a6e --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineImagesEdgeZoneOperations.cs @@ -0,0 +1,197 @@ +// +// 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; + + /// + /// VirtualMachineImagesEdgeZoneOperations operations. + /// + public partial interface IVirtualMachineImagesEdgeZoneOperations + { + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that + /// matches supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData + /// query. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image offers for the specified + /// location, edge zone and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// 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>> ListOffersWithHttpMessagesAsync(string location, string edgeZone, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image publishers for the specified + /// Azure location and edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// 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>> ListPublishersWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image SKUs for the specified + /// location, edge zone, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs index 24a0c0a583d64..7d01ea2808edb 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs @@ -155,6 +155,10 @@ public partial interface IVirtualMachineScaleSetVMsOperations /// /// The instance ID of the virtual machine. /// + /// + /// Optional parameter to force delete a virtual machine from a VM + /// scale set. (Feature in Preview) + /// /// /// The headers that will be added to request. /// @@ -167,7 +171,7 @@ public partial interface IVirtualMachineScaleSetVMsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a virtual machine from a VM scale set. /// @@ -617,6 +621,10 @@ public partial interface IVirtualMachineScaleSetVMsOperations /// /// The instance ID of the virtual machine. /// + /// + /// Optional parameter to force delete a virtual machine from a VM + /// scale set. (Feature in Preview) + /// /// /// The headers that will be added to request. /// @@ -629,7 +637,7 @@ public partial interface IVirtualMachineScaleSetVMsOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Power off (stop) a virtual machine in a VM scale set. Note that /// resources are still attached and you are getting charged for the diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs index 9ca46d37e2fc2..6af7aab40f00f 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs @@ -23,6 +23,30 @@ namespace Microsoft.Azure.Management.Compute /// public partial interface IVirtualMachineScaleSetsOperations { + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The location for which VM scale sets under the subscription are + /// queried. + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update a VM scale set. /// @@ -88,6 +112,10 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// The name of the VM scale set. /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in + /// Preview) + /// /// /// The headers that will be added to request. /// @@ -100,7 +128,7 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Display information about a virtual machine scale set. /// @@ -168,6 +196,10 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// The virtual machine scale set instance ids. /// + /// + /// Optional parameter to force delete virtual machines from the VM + /// scale set. (Feature in Preview) + /// /// /// The headers that will be added to request. /// @@ -180,7 +212,7 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// Thrown when a required parameter is null /// - Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the status of a VM scale set instance. /// @@ -682,6 +714,10 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// The name of the VM scale set. /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in + /// Preview) + /// /// /// The headers that will be added to request. /// @@ -694,7 +730,7 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deallocates specific virtual machines in a VM scale set. Shuts down /// the virtual machines and releases the compute resources. You are @@ -737,6 +773,10 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// The virtual machine scale set instance ids. /// + /// + /// Optional parameter to force delete virtual machines from the VM + /// scale set. (Feature in Preview) + /// /// /// The headers that will be added to request. /// @@ -749,7 +789,7 @@ public partial interface IVirtualMachineScaleSetsOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Power off (stop) one or more virtual machines in a VM scale set. /// Note that resources are still attached and you are getting charged @@ -1007,6 +1047,29 @@ public partial interface IVirtualMachineScaleSetsOperations /// Task BeginSetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets a list of all VM scale sets under a resource group. /// /// 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..818ce5adb86a0 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,10 @@ public partial interface IVirtualMachinesOperations /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines.(Feature in + /// Preview) + /// /// /// The headers that will be added to request. /// @@ -154,7 +158,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. @@ -611,6 +615,34 @@ public partial interface IVirtualMachinesOperations /// Task> AssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// 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> InstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Run command on the VM. /// /// @@ -733,6 +765,10 @@ public partial interface IVirtualMachinesOperations /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines.(Feature in + /// Preview) + /// /// /// The headers that will be added to request. /// @@ -745,7 +781,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 @@ -988,6 +1024,34 @@ public partial interface IVirtualMachinesOperations /// Task> BeginAssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// 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> BeginInstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Run command on the VM. /// /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs index 39a12de9721a2..9ccac6de301c5 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs @@ -169,7 +169,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +361,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -541,7 +541,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -742,7 +742,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -968,7 +968,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1184,7 +1184,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs index b31614b702f21..90df713f2e745 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs @@ -152,7 +152,7 @@ internal LogAnalyticsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -363,7 +363,7 @@ internal LogAnalyticsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApplicationProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApplicationProfile.cs new file mode 100644 index 0000000000000..4b7ed0d431cef --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ApplicationProfile.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; + + /// + /// Contains the list of gallery applications that should be made available + /// to the VM/VMSS + /// + public partial class ApplicationProfile + { + /// + /// Initializes a new instance of the ApplicationProfile class. + /// + public ApplicationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationProfile class. + /// + /// Specifies the gallery + /// applications that should be made available to the VM/VMSS + public ApplicationProfile(IList galleryApplications = default(IList)) + { + GalleryApplications = galleryApplications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "galleryApplications")] + public IList GalleryApplications { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailablePatchSummary.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailablePatchSummary.cs index a3968ca587626..322c7909b5926 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailablePatchSummary.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AvailablePatchSummary.cs @@ -32,9 +32,10 @@ public AvailablePatchSummary() /// /// The overall success or failure status of the /// operation. It remains "InProgress" until the operation completes. - /// At that point it will become "Failed", "Succeeded", or - /// "CompletedWithWarnings.". Possible values include: 'InProgress', - /// 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' /// The activity ID of the operation /// that produced this result. It is used to correlate across CRP and /// extension logs. @@ -74,9 +75,9 @@ public AvailablePatchSummary() /// /// Gets the overall success or failure status of the operation. It /// remains "InProgress" until the operation completes. At that point - /// it will become "Failed", "Succeeded", or "CompletedWithWarnings.". - /// Possible values include: 'InProgress', 'Failed', 'Succeeded', - /// 'CompletedWithWarnings' + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' /// [JsonProperty(PropertyName = "status")] public string Status { get; private set; } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs index 39c430dc88600..4adc5176ab56c 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs @@ -66,6 +66,20 @@ public DataDisk() /// Specifies whether the data disk is in /// process of detachment from the /// VirtualMachine/VirtualMachineScaleset + /// Specifies the detach behavior to be used + /// while detaching a disk or which is already in the process of + /// detachment from the virtual machine. Supported values: + /// **ForceDetach**. <br><br> detachOption: **ForceDetach** + /// is applicable only for managed data disks. If a previous detachment + /// attempt of the data disk did not complete due to an unexpected + /// failure from the virtual machine and the disk is still not released + /// then use force-detach as a last resort option to detach the disk + /// forcibly from the VM. All writes might not have been flushed when + /// using this detach behavior. <br><br> This feature is + /// still in preview mode and is not supported for + /// VirtualMachineScaleSet. To force-detach a data disk update + /// toBeDetached to 'true' along with setting detachOption: + /// 'ForceDetach'. Possible values include: 'ForceDetach' /// Specifies the Read-Write IOPS for /// the managed disk when StorageAccountType is UltraSSD_LRS. Returned /// only for VirtualMachine ScaleSet VM disks. Can be updated only via @@ -75,7 +89,7 @@ public DataDisk() /// UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. /// Can be updated only via updates to the VirtualMachine Scale /// Set. - public DataDisk(int lun, string createOption, string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), bool? toBeDetached = default(bool?), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?)) + public DataDisk(int lun, string createOption, string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), bool? toBeDetached = default(bool?), string detachOption = default(string), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?)) { Lun = lun; Name = name; @@ -87,6 +101,7 @@ public DataDisk() DiskSizeGB = diskSizeGB; ManagedDisk = managedDisk; ToBeDetached = toBeDetached; + DetachOption = detachOption; DiskIOPSReadWrite = diskIOPSReadWrite; DiskMBpsReadWrite = diskMBpsReadWrite; CustomInit(); @@ -183,6 +198,25 @@ public DataDisk() [JsonProperty(PropertyName = "toBeDetached")] public bool? ToBeDetached { get; set; } + /// + /// Gets or sets specifies the detach behavior to be used while + /// detaching a disk or which is already in the process of detachment + /// from the virtual machine. Supported values: **ForceDetach**. + /// &lt;br&gt;&lt;br&gt; detachOption: **ForceDetach** + /// is applicable only for managed data disks. If a previous detachment + /// attempt of the data disk did not complete due to an unexpected + /// failure from the virtual machine and the disk is still not released + /// then use force-detach as a last resort option to detach the disk + /// forcibly from the VM. All writes might not have been flushed when + /// using this detach behavior. &lt;br&gt;&lt;br&gt; + /// This feature is still in preview mode and is not supported for + /// VirtualMachineScaleSet. To force-detach a data disk update + /// toBeDetached to 'true' along with setting detachOption: + /// 'ForceDetach'. Possible values include: 'ForceDetach' + /// + [JsonProperty(PropertyName = "detachOption")] + public string DetachOption { get; set; } + /// /// Gets specifies the Read-Write IOPS for the managed disk when /// StorageAccountType is UltraSSD_LRS. Returned only for diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHost.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHost.cs index 26a73584615c9..2492e07e7fed4 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHost.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHost.cs @@ -168,10 +168,6 @@ public override void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); } - if (PlatformFaultDomain > 2) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PlatformFaultDomain", 2); - } if (PlatformFaultDomain < 0) { throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomain", 0); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroup.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroup.cs index 2b5ce35389aa0..bb23e586e1789 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroup.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroup.cs @@ -54,8 +54,8 @@ public DedicatedHostGroup() /// machines or virtual machine scale sets can be placed automatically /// on the dedicated host group. Automatic placement means resources /// are allocated on dedicated hosts, that are chosen by Azure, under - /// the dedicated host group. The value is defaulted to 'true' when not - /// provided. <br><br>Minimum api-version: + /// the dedicated host group. The value is defaulted to 'false' when + /// not provided. <br><br>Minimum api-version: /// 2020-06-01. /// Availability Zone to use for this host group. /// Only single zone is supported. The zone can be assigned only during @@ -104,7 +104,7 @@ public DedicatedHostGroup() /// scale sets can be placed automatically on the dedicated host group. /// Automatic placement means resources are allocated on dedicated /// hosts, that are chosen by Azure, under the dedicated host group. - /// The value is defaulted to 'true' when not provided. + /// The value is defaulted to 'false' when not provided. /// &lt;br&gt;&lt;br&gt;Minimum api-version: /// 2020-06-01. /// @@ -130,10 +130,6 @@ public DedicatedHostGroup() public override void Validate() { base.Validate(); - if (PlatformFaultDomainCount > 3) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PlatformFaultDomainCount", 3); - } if (PlatformFaultDomainCount < 1) { throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomainCount", 1); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs index fc9d5783c8072..cdd31b9d1d48f 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs @@ -47,8 +47,8 @@ public DedicatedHostGroupUpdate() /// machines or virtual machine scale sets can be placed automatically /// on the dedicated host group. Automatic placement means resources /// are allocated on dedicated hosts, that are chosen by Azure, under - /// the dedicated host group. The value is defaulted to 'true' when not - /// provided. <br><br>Minimum api-version: + /// the dedicated host group. The value is defaulted to 'false' when + /// not provided. <br><br>Minimum api-version: /// 2020-06-01. /// Availability Zone to use for this host group. /// Only single zone is supported. The zone can be assigned only during @@ -97,7 +97,7 @@ public DedicatedHostGroupUpdate() /// scale sets can be placed automatically on the dedicated host group. /// Automatic placement means resources are allocated on dedicated /// hosts, that are chosen by Azure, under the dedicated host group. - /// The value is defaulted to 'true' when not provided. + /// The value is defaulted to 'false' when not provided. /// &lt;br&gt;&lt;br&gt;Minimum api-version: /// 2020-06-01. /// @@ -122,10 +122,6 @@ public DedicatedHostGroupUpdate() /// public virtual void Validate() { - if (PlatformFaultDomainCount > 3) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PlatformFaultDomainCount", 3); - } if (PlatformFaultDomainCount < 1) { throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomainCount", 1); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostUpdate.cs index 99a1a24361c2c..b49fbb5da1485 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DedicatedHostUpdate.cs @@ -148,10 +148,6 @@ public DedicatedHostUpdate() /// public virtual void Validate() { - if (PlatformFaultDomain > 2) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PlatformFaultDomain", 2); - } if (PlatformFaultDomain < 0) { throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomain", 0); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskDetachOptionTypes.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskDetachOptionTypes.cs new file mode 100644 index 0000000000000..9244426d7ec0f --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskDetachOptionTypes.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 DiskDetachOptionTypes. + /// + public static class DiskDetachOptionTypes + { + public const string ForceDetach = "ForceDetach"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocation.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocation.cs new file mode 100644 index 0000000000000..5e8cf1371fd0b --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocation.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ExtendedLocation complex type. + /// + public partial class ExtendedLocation + { + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + public ExtendedLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + /// The name of the extended location. + public ExtendedLocation(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for ExtendedLocation class. + /// + static ExtendedLocation() + { + Type = "EdgeZone"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extended location. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The type of the extended location. + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocationTypes.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocationTypes.cs new file mode 100644 index 0000000000000..77e0b2c669588 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ExtendedLocationTypes.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 ExtendedLocationTypes. + /// + public static class ExtendedLocationTypes + { + public const string EdgeZone = "EdgeZone"; + } +} 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..f6e7ac008e700 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,9 +45,9 @@ 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. 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/HardwareProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HardwareProfile.cs index 93319ecbc5b0d..d82198706c791 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HardwareProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/HardwareProfile.cs @@ -29,21 +29,24 @@ public HardwareProfile() /// /// Initializes a new instance of the HardwareProfile class. /// - /// Specifies the size of the virtual machine. For - /// more information about virtual machine sizes, see [Sizes for - /// virtual - /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-sizes?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). - /// <br><br> The available VM sizes depend on region and - /// availability set. For a list of available sizes use these APIs: - /// <br><br> [List all available virtual machine sizes in - /// an availability + /// Specifies the size of the virtual machine. + /// <br><br> The enum data type is currently deprecated and + /// will be removed by December 23rd 2023. <br><br> + /// Recommended way to get the list of available sizes is using these + /// APIs: <br><br> [List all available virtual machine + /// sizes in an availability /// set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) /// <br><br> [List all available virtual machine sizes in a - /// region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list) + /// region]( + /// https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) /// <br><br> [List all available virtual machine sizes for /// resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). - /// Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', - /// 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', + /// For more information about virtual machine sizes, see [Sizes for + /// virtual + /// machines](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes). + /// <br><br> The available VM sizes depend on region and + /// availability set. Possible values include: 'Basic_A0', 'Basic_A1', + /// 'Basic_A2', 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', /// 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5', /// 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', /// 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2_v2', @@ -104,40 +107,44 @@ public HardwareProfile() partial void CustomInit(); /// - /// Gets or sets specifies the size of the virtual machine. For more - /// information about virtual machine sizes, see [Sizes for virtual - /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-sizes?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). - /// &lt;br&gt;&lt;br&gt; The available VM sizes depend - /// on region and availability set. For a list of available sizes use - /// these APIs: &lt;br&gt;&lt;br&gt; [List all - /// available virtual machine sizes in an availability + /// Gets or sets specifies the size of the virtual machine. + /// &lt;br&gt;&lt;br&gt; The enum data type is + /// currently deprecated and will be removed by December 23rd 2023. + /// &lt;br&gt;&lt;br&gt; Recommended way to get the + /// list of available sizes is using these APIs: + /// &lt;br&gt;&lt;br&gt; [List all available virtual + /// machine sizes in an availability /// set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) /// &lt;br&gt;&lt;br&gt; [List all available virtual - /// machine sizes in a - /// region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list) + /// machine sizes in a region]( + /// https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) /// &lt;br&gt;&lt;br&gt; [List all available virtual /// machine sizes for /// resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). - /// Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', - /// 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', - /// 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5', - /// 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', - /// 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2_v2', - /// 'Standard_A4_v2', 'Standard_A8_v2', 'Standard_A2m_v2', - /// 'Standard_A4m_v2', 'Standard_A8m_v2', 'Standard_B1s', - /// 'Standard_B1ms', 'Standard_B2s', 'Standard_B2ms', 'Standard_B4ms', - /// 'Standard_B8ms', 'Standard_D1', 'Standard_D2', 'Standard_D3', - /// 'Standard_D4', 'Standard_D11', 'Standard_D12', 'Standard_D13', - /// 'Standard_D14', 'Standard_D1_v2', 'Standard_D2_v2', - /// 'Standard_D3_v2', 'Standard_D4_v2', 'Standard_D5_v2', - /// 'Standard_D2_v3', 'Standard_D4_v3', 'Standard_D8_v3', - /// 'Standard_D16_v3', 'Standard_D32_v3', 'Standard_D64_v3', - /// 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', - /// 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', - /// 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2', - /// 'Standard_D14_v2', 'Standard_D15_v2', 'Standard_DS1', - /// 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', - /// 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', + /// For more information about virtual machine sizes, see [Sizes for + /// virtual + /// machines](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes). + /// &lt;br&gt;&lt;br&gt; The available VM sizes depend + /// on region and availability set. Possible values include: + /// 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', 'Basic_A4', + /// 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', + /// 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', + /// 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', + /// 'Standard_A1_v2', 'Standard_A2_v2', 'Standard_A4_v2', + /// 'Standard_A8_v2', 'Standard_A2m_v2', 'Standard_A4m_v2', + /// 'Standard_A8m_v2', 'Standard_B1s', 'Standard_B1ms', 'Standard_B2s', + /// 'Standard_B2ms', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', + /// 'Standard_D2', 'Standard_D3', 'Standard_D4', 'Standard_D11', + /// 'Standard_D12', 'Standard_D13', 'Standard_D14', 'Standard_D1_v2', + /// 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2', + /// 'Standard_D5_v2', 'Standard_D2_v3', 'Standard_D4_v3', + /// 'Standard_D8_v3', 'Standard_D16_v3', 'Standard_D32_v3', + /// 'Standard_D64_v3', 'Standard_D2s_v3', 'Standard_D4s_v3', + /// 'Standard_D8s_v3', 'Standard_D16s_v3', 'Standard_D32s_v3', + /// 'Standard_D64s_v3', 'Standard_D11_v2', 'Standard_D12_v2', + /// 'Standard_D13_v2', 'Standard_D14_v2', 'Standard_D15_v2', + /// 'Standard_DS1', 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', + /// 'Standard_DS11', 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', /// 'Standard_DS1_v2', 'Standard_DS2_v2', 'Standard_DS3_v2', /// 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_DS11_v2', /// 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Image.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Image.cs index 75c0fef474e34..5affb9549c32b 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Image.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Image.cs @@ -49,13 +49,16 @@ public Image() /// Gets the HyperVGenerationType of the /// VirtualMachine created from the image. Possible values include: /// 'V1', 'V2' - public Image(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string)) + /// The extended location of the + /// Image. + public Image(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string), ExtendedLocation extendedLocation = default(ExtendedLocation)) : base(location, id, name, type, tags) { SourceVirtualMachine = sourceVirtualMachine; StorageProfile = storageProfile; ProvisioningState = provisioningState; HyperVGeneration = hyperVGeneration; + ExtendedLocation = extendedLocation; CustomInit(); } @@ -91,6 +94,12 @@ public Image() [JsonProperty(PropertyName = "properties.hyperVGeneration")] public string HyperVGeneration { get; set; } + /// + /// Gets or sets the extended location of the Image. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + /// /// Validate the object. /// @@ -104,6 +113,10 @@ public override void Validate() { StorageProfile.Validate(); } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } } } } 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/LastPatchInstallationSummary.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LastPatchInstallationSummary.cs index d1f5092726308..3afaee59807a3 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LastPatchInstallationSummary.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LastPatchInstallationSummary.cs @@ -33,24 +33,16 @@ public LastPatchInstallationSummary() /// /// The overall success or failure status of the /// operation. It remains "InProgress" until the operation completes. - /// At that point it will become "Failed", "Succeeded", or - /// "CompletedWithWarnings.". Possible values include: 'InProgress', - /// 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' /// The activity ID of the /// operation that produced this result. It is used to correlate across /// CRP and extension logs. /// Describes whether the /// operation ran out of time before it completed all its intended /// actions - /// The reboot status of the machine after - /// the patch operation. It will be in "NotNeeded" status if reboot is - /// not needed after the patch operation. "Required" will be the status - /// once the patch is applied and machine is required to reboot. - /// "Started" will be the reboot status when the machine has started to - /// reboot. "Failed" will be the status if the machine is failed to - /// reboot. "Completed" will be the status once the machine is rebooted - /// successfully. Possible values include: 'NotNeeded', 'Required', - /// 'Started', 'Failed', 'Completed' /// The number of all available /// patches but not going to be installed because it didn't match a /// classification or inclusion list entry. @@ -68,17 +60,14 @@ public LastPatchInstallationSummary() /// began. /// The UTC timestamp when the operation /// began. - /// The person or system account that started - /// the operation /// The errors that were encountered during /// execution of the operation. The details array contains the list of /// them. - public LastPatchInstallationSummary(string status = default(string), string installationActivityId = default(string), bool? maintenanceWindowExceeded = default(bool?), string rebootStatus = default(string), int? notSelectedPatchCount = default(int?), int? excludedPatchCount = default(int?), int? pendingPatchCount = default(int?), int? installedPatchCount = default(int?), int? failedPatchCount = default(int?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? lastModifiedTime = default(System.DateTime?), string startedBy = default(string), ApiError error = default(ApiError)) + public LastPatchInstallationSummary(string status = default(string), string installationActivityId = default(string), bool? maintenanceWindowExceeded = default(bool?), int? notSelectedPatchCount = default(int?), int? excludedPatchCount = default(int?), int? pendingPatchCount = default(int?), int? installedPatchCount = default(int?), int? failedPatchCount = default(int?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? lastModifiedTime = default(System.DateTime?), ApiError error = default(ApiError)) { Status = status; InstallationActivityId = installationActivityId; MaintenanceWindowExceeded = maintenanceWindowExceeded; - RebootStatus = rebootStatus; NotSelectedPatchCount = notSelectedPatchCount; ExcludedPatchCount = excludedPatchCount; PendingPatchCount = pendingPatchCount; @@ -86,7 +75,6 @@ public LastPatchInstallationSummary() FailedPatchCount = failedPatchCount; StartTime = startTime; LastModifiedTime = lastModifiedTime; - StartedBy = startedBy; Error = error; CustomInit(); } @@ -99,9 +87,9 @@ public LastPatchInstallationSummary() /// /// Gets the overall success or failure status of the operation. It /// remains "InProgress" until the operation completes. At that point - /// it will become "Failed", "Succeeded", or "CompletedWithWarnings.". - /// Possible values include: 'InProgress', 'Failed', 'Succeeded', - /// 'CompletedWithWarnings' + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' /// [JsonProperty(PropertyName = "status")] public string Status { get; private set; } @@ -120,20 +108,6 @@ public LastPatchInstallationSummary() [JsonProperty(PropertyName = "maintenanceWindowExceeded")] public bool? MaintenanceWindowExceeded { get; private set; } - /// - /// Gets the reboot status of the machine after the patch operation. It - /// will be in "NotNeeded" status if reboot is not needed after the - /// patch operation. "Required" will be the status once the patch is - /// applied and machine is required to reboot. "Started" will be the - /// reboot status when the machine has started to reboot. "Failed" will - /// be the status if the machine is failed to reboot. "Completed" will - /// be the status once the machine is rebooted successfully. Possible - /// values include: 'NotNeeded', 'Required', 'Started', 'Failed', - /// 'Completed' - /// - [JsonProperty(PropertyName = "rebootStatus")] - public string RebootStatus { get; private set; } - /// /// Gets the number of all available patches but not going to be /// installed because it didn't match a classification or inclusion @@ -180,12 +154,6 @@ public LastPatchInstallationSummary() [JsonProperty(PropertyName = "lastModifiedTime")] public System.DateTime? LastModifiedTime { get; private set; } - /// - /// Gets the person or system account that started the operation - /// - [JsonProperty(PropertyName = "startedBy")] - public string StartedBy { get; private set; } - /// /// Gets the errors that were encountered during execution of the /// operation. The details array contains the list of them. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxConfiguration.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxConfiguration.cs index 4594ed63cf393..1ca79999bdbb8 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxConfiguration.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxConfiguration.cs @@ -45,11 +45,14 @@ public LinuxConfiguration() /// request body, default behavior is to set it to true. This will /// ensure that VM Agent is installed on the VM so that extensions can /// be added to the VM later. - public LinuxConfiguration(bool? disablePasswordAuthentication = default(bool?), SshConfiguration ssh = default(SshConfiguration), bool? provisionVMAgent = default(bool?)) + /// Specifies settings related to VM Guest + /// Patching on Linux. + public LinuxConfiguration(bool? disablePasswordAuthentication = default(bool?), SshConfiguration ssh = default(SshConfiguration), bool? provisionVMAgent = default(bool?), LinuxPatchSettings patchSettings = default(LinuxPatchSettings)) { DisablePasswordAuthentication = disablePasswordAuthentication; Ssh = ssh; ProvisionVMAgent = provisionVMAgent; + PatchSettings = patchSettings; CustomInit(); } @@ -82,5 +85,12 @@ public LinuxConfiguration() [JsonProperty(PropertyName = "provisionVMAgent")] public bool? ProvisionVMAgent { get; set; } + /// + /// Gets or sets specifies settings related to VM Guest Patching on + /// Linux. + /// + [JsonProperty(PropertyName = "patchSettings")] + public LinuxPatchSettings PatchSettings { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxParameters.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxParameters.cs new file mode 100644 index 0000000000000..4deea634136d5 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxParameters.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Input for InstallPatches on a Linux VM, as directly received by the API + /// + public partial class LinuxParameters + { + /// + /// Initializes a new instance of the LinuxParameters class. + /// + public LinuxParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxParameters class. + /// + /// The update classifications + /// to select when installing patches for Linux. + /// packages to include in the + /// patch operation. Format: packageName_packageVersion + /// packages to exclude in the + /// patch operation. Format: packageName_packageVersion + /// This is used as a maintenance run + /// identifier for Auto VM Guest Patching in Linux. + public LinuxParameters(IList classificationsToInclude = default(IList), IList packageNameMasksToInclude = default(IList), IList packageNameMasksToExclude = default(IList), string maintenanceRunId = default(string)) + { + ClassificationsToInclude = classificationsToInclude; + PackageNameMasksToInclude = packageNameMasksToInclude; + PackageNameMasksToExclude = packageNameMasksToExclude; + MaintenanceRunId = maintenanceRunId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the update classifications to select when installing + /// patches for Linux. + /// + [JsonProperty(PropertyName = "classificationsToInclude")] + public IList ClassificationsToInclude { get; set; } + + /// + /// Gets or sets packages to include in the patch operation. Format: + /// packageName_packageVersion + /// + [JsonProperty(PropertyName = "packageNameMasksToInclude")] + public IList PackageNameMasksToInclude { get; set; } + + /// + /// Gets or sets packages to exclude in the patch operation. Format: + /// packageName_packageVersion + /// + [JsonProperty(PropertyName = "packageNameMasksToExclude")] + public IList PackageNameMasksToExclude { get; set; } + + /// + /// Gets or sets this is used as a maintenance run identifier for Auto + /// VM Guest Patching in Linux. + /// + [JsonProperty(PropertyName = "maintenanceRunId")] + public string MaintenanceRunId { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxPatchSettings.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxPatchSettings.cs new file mode 100644 index 0000000000000..b330cbd7884a8 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxPatchSettings.cs @@ -0,0 +1,66 @@ +// +// 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; + + /// + /// Specifies settings related to VM Guest Patching on Linux. + /// + public partial class LinuxPatchSettings + { + /// + /// Initializes a new instance of the LinuxPatchSettings class. + /// + public LinuxPatchSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxPatchSettings class. + /// + /// Specifies the mode of VM Guest Patching to + /// IaaS virtual machine.<br /><br /> Possible values + /// are:<br /><br /> **ImageDefault** - The virtual + /// machine's default patching configuration is used. <br + /// /><br /> **AutomaticByPlatform** - The virtual machine + /// will be automatically updated by the platform. The property + /// provisionVMAgent must be true. Possible values include: + /// 'ImageDefault', 'AutomaticByPlatform' + public LinuxPatchSettings(string patchMode = default(string)) + { + PatchMode = patchMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mode of VM Guest Patching to IaaS + /// virtual machine.&lt;br /&gt;&lt;br /&gt; Possible + /// values are:&lt;br /&gt;&lt;br /&gt; + /// **ImageDefault** - The virtual machine's default patching + /// configuration is used. &lt;br /&gt;&lt;br /&gt; + /// **AutomaticByPlatform** - The virtual machine will be automatically + /// updated by the platform. The property provisionVMAgent must be + /// true. Possible values include: 'ImageDefault', + /// 'AutomaticByPlatform' + /// + [JsonProperty(PropertyName = "patchMode")] + public string PatchMode { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxVMGuestPatchMode.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxVMGuestPatchMode.cs new file mode 100644 index 0000000000000..403817291610a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/LinuxVMGuestPatchMode.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 LinuxVMGuestPatchMode. + /// + public static class LinuxVMGuestPatchMode + { + public const string ImageDefault = "ImageDefault"; + public const string AutomaticByPlatform = "AutomaticByPlatform"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationMode.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationMode.cs new file mode 100644 index 0000000000000..6333b9b1a1c98 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OrchestrationMode.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OrchestrationMode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OrchestrationMode + { + [EnumMember(Value = "Uniform")] + Uniform, + [EnumMember(Value = "Flexible")] + Flexible + } + internal static class OrchestrationModeEnumExtension + { + internal static string ToSerializedValue(this OrchestrationMode? value) + { + return value == null ? null : ((OrchestrationMode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OrchestrationMode value) + { + switch( value ) + { + case OrchestrationMode.Uniform: + return "Uniform"; + case OrchestrationMode.Flexible: + return "Flexible"; + } + return null; + } + + internal static OrchestrationMode? ParseOrchestrationMode(this string value) + { + switch( value ) + { + case "Uniform": + return OrchestrationMode.Uniform; + case "Flexible": + return OrchestrationMode.Flexible; + } + return null; + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchAssessmentState.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchAssessmentState.cs index d39f3abf85144..e38d2040f7884 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchAssessmentState.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchAssessmentState.cs @@ -16,11 +16,7 @@ namespace Microsoft.Azure.Management.Compute.Models /// public static class PatchAssessmentState { - public const string Installed = "Installed"; - public const string Failed = "Failed"; - public const string Excluded = "Excluded"; - public const string NotSelected = "NotSelected"; - public const string Pending = "Pending"; + public const string Unknown = "Unknown"; public const string Available = "Available"; } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationDetail.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationDetail.cs new file mode 100644 index 0000000000000..6dc51bd5402f2 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationDetail.cs @@ -0,0 +1,104 @@ +// +// 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; + + /// + /// Information about a specific patch that was encountered during an + /// installation action. + /// + public partial class PatchInstallationDetail + { + /// + /// Initializes a new instance of the PatchInstallationDetail class. + /// + public PatchInstallationDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PatchInstallationDetail class. + /// + /// A unique identifier for the patch. + /// The friendly name of the patch. + /// The version string of the package. It may + /// conform to Semantic Versioning. Only applies to Linux. + /// The KBID of the patch. Only applies to Windows + /// patches. + /// The classification(s) of the patch as + /// provided by the patch publisher. + /// The state of the patch after the + /// installation operation completed. Possible values include: + /// 'Unknown', 'Installed', 'Failed', 'Excluded', 'NotSelected', + /// 'Pending' + public PatchInstallationDetail(string patchId = default(string), string name = default(string), string version = default(string), string kbId = default(string), IList classifications = default(IList), string installationState = default(string)) + { + PatchId = patchId; + Name = name; + Version = version; + KbId = kbId; + Classifications = classifications; + InstallationState = installationState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique identifier for the patch. + /// + [JsonProperty(PropertyName = "patchId")] + public string PatchId { get; private set; } + + /// + /// Gets the friendly name of the patch. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the version string of the package. It may conform to Semantic + /// Versioning. Only applies to Linux. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + /// + /// Gets the KBID of the patch. Only applies to Windows patches. + /// + [JsonProperty(PropertyName = "kbId")] + public string KbId { get; private set; } + + /// + /// Gets the classification(s) of the patch as provided by the patch + /// publisher. + /// + [JsonProperty(PropertyName = "classifications")] + public IList Classifications { get; private set; } + + /// + /// Gets the state of the patch after the installation operation + /// completed. Possible values include: 'Unknown', 'Installed', + /// 'Failed', 'Excluded', 'NotSelected', 'Pending' + /// + [JsonProperty(PropertyName = "installationState")] + public string InstallationState { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationState.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationState.cs new file mode 100644 index 0000000000000..6ca7103442bae --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchInstallationState.cs @@ -0,0 +1,26 @@ +// +// 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 PatchInstallationState. + /// + public static class PatchInstallationState + { + public const string Unknown = "Unknown"; + public const string Installed = "Installed"; + public const string Failed = "Failed"; + public const string Excluded = "Excluded"; + public const string NotSelected = "NotSelected"; + public const string Pending = "Pending"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchOperationStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchOperationStatus.cs index 36860e3d42304..0d9c96f755a18 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchOperationStatus.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PatchOperationStatus.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.Management.Compute.Models /// public static class PatchOperationStatus { + public const string Unknown = "Unknown"; public const string InProgress = "InProgress"; public const string Failed = "Failed"; public const string Succeeded = "Succeeded"; 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/RollingUpgradePolicy.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradePolicy.cs index 2a43f60a0103f..cf56aac6c64fe 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradePolicy.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RollingUpgradePolicy.cs @@ -52,12 +52,20 @@ public RollingUpgradePolicy() /// completing the update for all virtual machines in one batch and /// starting the next batch. The time duration should be specified in /// ISO 8601 format. The default value is 0 seconds (PT0S). - public RollingUpgradePolicy(int? maxBatchInstancePercent = default(int?), int? maxUnhealthyInstancePercent = default(int?), int? maxUnhealthyUpgradedInstancePercent = default(int?), string pauseTimeBetweenBatches = default(string)) + /// Allow VMSS to ignore AZ + /// boundaries when constructing upgrade batches. Take into + /// consideration the Update Domain and maxBatchInstancePercent to + /// determine the batch size. + /// Upgrade all unhealthy + /// instances in a scale set before any healthy instances. + public RollingUpgradePolicy(int? maxBatchInstancePercent = default(int?), int? maxUnhealthyInstancePercent = default(int?), int? maxUnhealthyUpgradedInstancePercent = default(int?), string pauseTimeBetweenBatches = default(string), bool? enableCrossZoneUpgrade = default(bool?), bool? prioritizeUnhealthyInstances = default(bool?)) { MaxBatchInstancePercent = maxBatchInstancePercent; MaxUnhealthyInstancePercent = maxUnhealthyInstancePercent; MaxUnhealthyUpgradedInstancePercent = maxUnhealthyUpgradedInstancePercent; PauseTimeBetweenBatches = pauseTimeBetweenBatches; + EnableCrossZoneUpgrade = enableCrossZoneUpgrade; + PrioritizeUnhealthyInstances = prioritizeUnhealthyInstances; CustomInit(); } @@ -107,6 +115,21 @@ public RollingUpgradePolicy() [JsonProperty(PropertyName = "pauseTimeBetweenBatches")] public string PauseTimeBetweenBatches { get; set; } + /// + /// Gets or sets allow VMSS to ignore AZ boundaries when constructing + /// upgrade batches. Take into consideration the Update Domain and + /// maxBatchInstancePercent to determine the batch size. + /// + [JsonProperty(PropertyName = "enableCrossZoneUpgrade")] + public bool? EnableCrossZoneUpgrade { get; set; } + + /// + /// Gets or sets upgrade all unhealthy instances in a scale set before + /// any healthy instances. + /// + [JsonProperty(PropertyName = "prioritizeUnhealthyInstances")] + public bool? PrioritizeUnhealthyInstances { get; set; } + /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityProfile.cs index 323d109564f29..0be80d5c515a1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityProfile.cs @@ -30,6 +30,9 @@ public SecurityProfile() /// /// Initializes a new instance of the SecurityProfile class. /// + /// Specifies the security settings like + /// secure boot and vTPM used while creating the virtual machine. + /// <br><br>Minimum api-version: 2020-12-01 /// This property can be used by user in /// the request to enable or disable the Host Encryption for the /// virtual machine or virtual machine scale set. This will enable the @@ -37,9 +40,16 @@ public SecurityProfile() /// itself. <br><br> Default: The Encryption at host will /// be disabled unless this property is set to true for the /// resource. - public SecurityProfile(bool? encryptionAtHost = default(bool?)) + /// Specifies the SecurityType of the + /// virtual machine. It is set as TrustedLaunch to enable UefiSettings. + /// <br><br> Default: UefiSettings will not be enabled + /// unless this property is set as TrustedLaunch. Possible values + /// include: 'TrustedLaunch' + public SecurityProfile(UefiSettings uefiSettings = default(UefiSettings), bool? encryptionAtHost = default(bool?), SecurityTypes? securityType = default(SecurityTypes?)) { + UefiSettings = uefiSettings; EncryptionAtHost = encryptionAtHost; + SecurityType = securityType; CustomInit(); } @@ -48,6 +58,14 @@ public SecurityProfile() /// partial void CustomInit(); + /// + /// Gets or sets specifies the security settings like secure boot and + /// vTPM used while creating the virtual machine. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: 2020-12-01 + /// + [JsonProperty(PropertyName = "uefiSettings")] + public UefiSettings UefiSettings { get; set; } + /// /// Gets or sets this property can be used by user in the request to /// enable or disable the Host Encryption for the virtual machine or @@ -60,5 +78,15 @@ public SecurityProfile() [JsonProperty(PropertyName = "encryptionAtHost")] public bool? EncryptionAtHost { get; set; } + /// + /// Gets or sets specifies the SecurityType of the virtual machine. It + /// is set as TrustedLaunch to enable UefiSettings. + /// &lt;br&gt;&lt;br&gt; Default: UefiSettings will not + /// be enabled unless this property is set as TrustedLaunch. Possible + /// values include: 'TrustedLaunch' + /// + [JsonProperty(PropertyName = "securityType")] + public SecurityTypes? SecurityType { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityTypes.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityTypes.cs new file mode 100644 index 0000000000000..aad5bca9275b7 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SecurityTypes.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SecurityTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SecurityTypes + { + [EnumMember(Value = "TrustedLaunch")] + TrustedLaunch + } + internal static class SecurityTypesEnumExtension + { + internal static string ToSerializedValue(this SecurityTypes? value) + { + return value == null ? null : ((SecurityTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SecurityTypes value) + { + switch( value ) + { + case SecurityTypes.TrustedLaunch: + return "TrustedLaunch"; + } + return null; + } + + internal static SecurityTypes? ParseSecurityTypes(this string value) + { + switch( value ) + { + case "TrustedLaunch": + return SecurityTypes.TrustedLaunch; + } + return null; + } + } +} 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/UefiSettings.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UefiSettings.cs new file mode 100644 index 0000000000000..09b95b6c3d096 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/UefiSettings.cs @@ -0,0 +1,69 @@ +// +// 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; + + /// + /// Specifies the security settings like secure boot and vTPM used while + /// creating the virtual machine. <br><br>Minimum api-version: + /// 2020-12-01 + /// + public partial class UefiSettings + { + /// + /// Initializes a new instance of the UefiSettings class. + /// + public UefiSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UefiSettings class. + /// + /// Specifies whether secure boot + /// should be enabled on the virtual machine. + /// <br><br>Minimum api-version: 2020-12-01 + /// Specifies whether vTPM should be enabled + /// on the virtual machine. <br><br>Minimum api-version: + /// 2020-12-01 + public UefiSettings(bool? secureBootEnabled = default(bool?), bool? vTpmEnabled = default(bool?)) + { + SecureBootEnabled = secureBootEnabled; + VTpmEnabled = vTpmEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether secure boot should be enabled on the + /// virtual machine. &lt;br&gt;&lt;br&gt;Minimum + /// api-version: 2020-12-01 + /// + [JsonProperty(PropertyName = "secureBootEnabled")] + public bool? SecureBootEnabled { get; set; } + + /// + /// Gets or sets specifies whether vTPM should be enabled on the + /// virtual machine. &lt;br&gt;&lt;br&gt;Minimum + /// api-version: 2020-12-01 + /// + [JsonProperty(PropertyName = "vTpmEnabled")] + public bool? VTpmEnabled { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGalleryApplication.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGalleryApplication.cs new file mode 100644 index 0000000000000..92f61431fa60e --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGalleryApplication.cs @@ -0,0 +1,116 @@ +// +// 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; + + /// + /// Specifies the required information to reference a compute gallery + /// application version + /// + public partial class VMGalleryApplication + { + /// + /// Initializes a new instance of the VMGalleryApplication class. + /// + public VMGalleryApplication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMGalleryApplication class. + /// + /// Specifies the + /// GalleryApplicationVersion reference in URL form. e.g. + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + /// Optional, Specifies a passthrough value for more + /// generic context. + /// Optional, Specifies the order in which the + /// packages have to be installed, has no effect if manuallyManaged is + /// set to true + /// Specifies whether the gallery + /// application would be manually managed. If set to true, the + /// VMApplicationExtension would not manage the gallery + /// application + /// Optional, Specifies the uri to + /// an azure blob that will replace the default configuration for the + /// package if provided + public VMGalleryApplication(string packageReferenceId, string tags = default(string), int? order = default(int?), bool? manuallyManaged = default(bool?), string configurationReference = default(string)) + { + Tags = tags; + Order = order; + ManuallyManaged = manuallyManaged; + PackageReferenceId = packageReferenceId; + ConfigurationReference = configurationReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets optional, Specifies a passthrough value for more + /// generic context. + /// + [JsonProperty(PropertyName = "tags")] + public string Tags { get; set; } + + /// + /// Gets or sets optional, Specifies the order in which the packages + /// have to be installed, has no effect if manuallyManaged is set to + /// true + /// + [JsonProperty(PropertyName = "order")] + public int? Order { get; set; } + + /// + /// Gets or sets specifies whether the gallery application would be + /// manually managed. If set to true, the VMApplicationExtension would + /// not manage the gallery application + /// + [JsonProperty(PropertyName = "manuallyManaged")] + public bool? ManuallyManaged { get; set; } + + /// + /// Gets or sets specifies the GalleryApplicationVersion reference in + /// URL form. e.g. + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + /// + [JsonProperty(PropertyName = "packageReferenceId")] + public string PackageReferenceId { get; set; } + + /// + /// Gets or sets optional, Specifies the uri to an azure blob that will + /// replace the default configuration for the package if provided + /// + [JsonProperty(PropertyName = "configurationReference")] + public string ConfigurationReference { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PackageReferenceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PackageReferenceId"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationLinux.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationLinux.cs new file mode 100644 index 0000000000000..0cc53c8e44fca --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationLinux.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 VMGuestPatchClassificationLinux. + /// + public static class VMGuestPatchClassificationLinux + { + public const string Critical = "Critical"; + public const string Security = "Security"; + public const string Other = "Other"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationWindows.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationWindows.cs new file mode 100644 index 0000000000000..e98f65e64153f --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchClassificationWindows.cs @@ -0,0 +1,28 @@ +// +// 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 VMGuestPatchClassificationWindows. + /// + public static class VMGuestPatchClassificationWindows + { + public const string Critical = "Critical"; + public const string Security = "Security"; + public const string UpdateRollUp = "UpdateRollUp"; + public const string FeaturePack = "FeaturePack"; + public const string ServicePack = "ServicePack"; + public const string Definition = "Definition"; + public const string Tools = "Tools"; + public const string Updates = "Updates"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootBehavior.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootBehavior.cs new file mode 100644 index 0000000000000..87a76dded6d92 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootBehavior.cs @@ -0,0 +1,24 @@ +// +// 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 VMGuestPatchRebootBehavior. + /// + public static class VMGuestPatchRebootBehavior + { + public const string Unknown = "Unknown"; + public const string NeverReboots = "NeverReboots"; + public const string AlwaysRequiresReboot = "AlwaysRequiresReboot"; + public const string CanRequestReboot = "CanRequestReboot"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootSetting.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootSetting.cs new file mode 100644 index 0000000000000..ebfef92400a41 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootSetting.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 VMGuestPatchRebootSetting. + /// + public static class VMGuestPatchRebootSetting + { + public const string IfRequired = "IfRequired"; + public const string Never = "Never"; + public const string Always = "Always"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootStatus.cs new file mode 100644 index 0000000000000..f9bf1a04138e6 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VMGuestPatchRebootStatus.cs @@ -0,0 +1,26 @@ +// +// 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 VMGuestPatchRebootStatus. + /// + public static class VMGuestPatchRebootStatus + { + public const string Unknown = "Unknown"; + public const string NotNeeded = "NotNeeded"; + public const string Required = "Required"; + public const string Started = "Started"; + public const string Failed = "Failed"; + public const string Completed = "Completed"; + } +} 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..712142f6324b9 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 @@ -48,6 +48,8 @@ public VirtualMachine() /// Enter any required information and then click **Save**. /// Specifies the hardware settings for /// the virtual machine. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS /// Specifies the storage settings for the /// virtual machine disks. /// Specifies additional @@ -92,6 +94,18 @@ public VirtualMachine() /// the proximity placement group that the virtual machine should be /// assigned to. <br><br>Minimum api-version: /// 2018-04-01. + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains.<br><li>This is applicable only if the + /// 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.<li>The Virtual Machine Scale Set that is referenced, + /// must have 'platformFaultDomainCount' &gt; 1.<li>This + /// property cannot be updated once the Virtual Machine is + /// created.<li>Fault domain assignment can be viewed in the + /// Virtual Machine Instance View.<br><br>Minimum + /// api‐version: 2020‐12‐01 /// Specifies the priority for the virtual /// machine. <br><br>Minimum api-version: 2019-03-01. /// Possible values include: 'Regular', 'Low', 'Spot' @@ -142,11 +156,14 @@ public VirtualMachine() /// The identity of the virtual machine, if /// configured. /// The virtual machine zones. - public VirtualMachine(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), IList resources = default(IList), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList)) + /// The extended location of the Virtual + /// Machine. + public VirtualMachine(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), int? platformFaultDomain = default(int?), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), IList resources = default(IList), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) : base(location, id, name, type, tags) { Plan = plan; HardwareProfile = hardwareProfile; + ApplicationProfile = applicationProfile; StorageProfile = storageProfile; AdditionalCapabilities = additionalCapabilities; OsProfile = osProfile; @@ -156,6 +173,7 @@ public VirtualMachine() AvailabilitySet = availabilitySet; VirtualMachineScaleSet = virtualMachineScaleSet; ProximityPlacementGroup = proximityPlacementGroup; + PlatformFaultDomain = platformFaultDomain; Priority = priority; EvictionPolicy = evictionPolicy; BillingProfile = billingProfile; @@ -169,6 +187,7 @@ public VirtualMachine() Resources = resources; Identity = identity; Zones = zones; + ExtendedLocation = extendedLocation; CustomInit(); } @@ -196,6 +215,13 @@ public VirtualMachine() [JsonProperty(PropertyName = "properties.hardwareProfile")] public HardwareProfile HardwareProfile { get; set; } + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + /// /// Gets or sets specifies the storage settings for the virtual machine /// disks. @@ -285,6 +311,24 @@ public VirtualMachine() [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] public SubResource ProximityPlacementGroup { get; set; } + /// + /// Gets or sets specifies the scale set logical fault domain into + /// which the Virtual Machine will be created. By default, the Virtual + /// Machine will by automatically assigned to a fault domain that best + /// maintains balance across available fault + /// domains.&lt;br&gt;&lt;li&gt;This is applicable only + /// if the 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.&lt;li&gt;The Virtual Machine Scale Set that is + /// referenced, must have 'platformFaultDomainCount' &amp;gt; + /// 1.&lt;li&gt;This property cannot be updated once the + /// Virtual Machine is created.&lt;li&gt;Fault domain + /// assignment can be viewed in the Virtual Machine Instance + /// View.&lt;br&gt;&lt;br&gt;Minimum api‐version: + /// 2020‐12‐01 + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + /// /// Gets or sets specifies the priority for the virtual machine. /// &lt;br&gt;&lt;br&gt;Minimum api-version: @@ -401,6 +445,12 @@ public VirtualMachine() [JsonProperty(PropertyName = "zones")] public IList Zones { get; set; } + /// + /// Gets or sets the extended location of the Virtual Machine. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + /// /// Validate the object. /// @@ -424,6 +474,10 @@ public override void Validate() } } } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } } } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs index 3547230ce763f..9bb2a7c3e50cf 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs @@ -35,9 +35,10 @@ public VirtualMachineAssessPatchesResult() /// /// The overall success or failure status of the /// operation. It remains "InProgress" until the operation completes. - /// At that point it will become "Failed", "Succeeded", or - /// "CompletedWithWarnings.". Possible values include: 'InProgress', - /// 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' /// The activity ID of the operation /// that produced this result. It is used to correlate across CRP and /// extension logs. @@ -51,12 +52,12 @@ public VirtualMachineAssessPatchesResult() /// excluding critical and security. /// The UTC timestamp when the operation /// began. - /// The list of patches that have been detected - /// as available for installation. + /// The list of patches that have been + /// detected as available for installation. /// The errors that were encountered during /// execution of the operation. The details array contains the list of /// them. - public VirtualMachineAssessPatchesResult(string status = default(string), string assessmentActivityId = default(string), bool? rebootPending = default(bool?), int? criticalAndSecurityPatchCount = default(int?), int? otherPatchCount = default(int?), System.DateTime? startDateTime = default(System.DateTime?), IList patches = default(IList), ApiError error = default(ApiError)) + public VirtualMachineAssessPatchesResult(string status = default(string), string assessmentActivityId = default(string), bool? rebootPending = default(bool?), int? criticalAndSecurityPatchCount = default(int?), int? otherPatchCount = default(int?), System.DateTime? startDateTime = default(System.DateTime?), IList availablePatches = default(IList), ApiError error = default(ApiError)) { Status = status; AssessmentActivityId = assessmentActivityId; @@ -64,7 +65,7 @@ public VirtualMachineAssessPatchesResult() CriticalAndSecurityPatchCount = criticalAndSecurityPatchCount; OtherPatchCount = otherPatchCount; StartDateTime = startDateTime; - Patches = patches; + AvailablePatches = availablePatches; Error = error; CustomInit(); } @@ -77,9 +78,9 @@ public VirtualMachineAssessPatchesResult() /// /// Gets the overall success or failure status of the operation. It /// remains "InProgress" until the operation completes. At that point - /// it will become "Failed", "Succeeded", or "CompletedWithWarnings.". - /// Possible values include: 'InProgress', 'Failed', 'Succeeded', - /// 'CompletedWithWarnings' + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' /// [JsonProperty(PropertyName = "status")] public string Status { get; private set; } @@ -123,8 +124,8 @@ public VirtualMachineAssessPatchesResult() /// Gets the list of patches that have been detected as available for /// installation. /// - [JsonProperty(PropertyName = "patches")] - public IList Patches { get; private set; } + [JsonProperty(PropertyName = "availablePatches")] + public IList AvailablePatches { get; private set; } /// /// Gets the errors that were encountered during execution of the diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImage.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImage.cs index 8a2b6409b7e49..f7d1df4a903c9 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImage.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImage.cs @@ -42,12 +42,14 @@ public VirtualMachineImage() /// virtual machine. For more information about using tags, see [Using /// tags to organize your Azure /// resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + /// The extended location of the Virtual + /// Machine. /// Possible values include: 'V1', /// 'V2' /// Specifies disallowed configuration for the /// VirtualMachine created from the image - public VirtualMachineImage(string name, string location, string id = default(string), IDictionary tags = default(IDictionary), PurchasePlan plan = default(PurchasePlan), OSDiskImage osDiskImage = default(OSDiskImage), IList dataDiskImages = default(IList), AutomaticOSUpgradeProperties automaticOSUpgradeProperties = default(AutomaticOSUpgradeProperties), string hyperVGeneration = default(string), DisallowedConfiguration disallowed = default(DisallowedConfiguration)) - : base(name, location, id, tags) + public VirtualMachineImage(string name, string location, string id = default(string), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation), PurchasePlan plan = default(PurchasePlan), OSDiskImage osDiskImage = default(OSDiskImage), IList dataDiskImages = default(IList), AutomaticOSUpgradeProperties automaticOSUpgradeProperties = default(AutomaticOSUpgradeProperties), string hyperVGeneration = default(string), DisallowedConfiguration disallowed = default(DisallowedConfiguration)) + : base(name, location, id, tags, extendedLocation) { Plan = plan; OsDiskImage = osDiskImage; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImageResource.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImageResource.cs index 880249a5672c0..174b5698e0ec1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImageResource.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineImageResource.cs @@ -42,12 +42,15 @@ public VirtualMachineImageResource() /// virtual machine. For more information about using tags, see [Using /// tags to organize your Azure /// resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). - public VirtualMachineImageResource(string name, string location, string id = default(string), IDictionary tags = default(IDictionary)) + /// The extended location of the Virtual + /// Machine. + public VirtualMachineImageResource(string name, string location, string id = default(string), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation)) : base(id) { Name = name; Location = location; Tags = tags; + ExtendedLocation = extendedLocation; CustomInit(); } @@ -77,6 +80,12 @@ public VirtualMachineImageResource() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } + /// + /// Gets or sets the extended location of the Virtual Machine. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + /// /// Validate the object. /// @@ -93,6 +102,10 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Location"); } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } } } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesParameters.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesParameters.cs new file mode 100644 index 0000000000000..e7170d046d5b0 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesParameters.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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input for InstallPatches as directly received by the API + /// + public partial class VirtualMachineInstallPatchesParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesParameters class. + /// + public VirtualMachineInstallPatchesParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesParameters class. + /// + /// Specifies the maximum amount of time + /// that the operation will run. It must be an ISO 8601-compliant + /// duration string such as PT4H (4 hours) + /// Defines when it is acceptable to reboot + /// a VM during a software update operation. Possible values include: + /// 'IfRequired', 'Never', 'Always' + /// Input for InstallPatches on a + /// Windows VM, as directly received by the API + /// Input for InstallPatches on a Linux + /// VM, as directly received by the API + public VirtualMachineInstallPatchesParameters(string maximumDuration, string rebootSetting, WindowsParameters windowsParameters = default(WindowsParameters), LinuxParameters linuxParameters = default(LinuxParameters)) + { + MaximumDuration = maximumDuration; + RebootSetting = rebootSetting; + WindowsParameters = windowsParameters; + LinuxParameters = linuxParameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the maximum amount of time that the + /// operation will run. It must be an ISO 8601-compliant duration + /// string such as PT4H (4 hours) + /// + [JsonProperty(PropertyName = "maximumDuration")] + public string MaximumDuration { get; set; } + + /// + /// Gets or sets defines when it is acceptable to reboot a VM during a + /// software update operation. Possible values include: 'IfRequired', + /// 'Never', 'Always' + /// + [JsonProperty(PropertyName = "rebootSetting")] + public string RebootSetting { get; set; } + + /// + /// Gets or sets input for InstallPatches on a Windows VM, as directly + /// received by the API + /// + [JsonProperty(PropertyName = "windowsParameters")] + public WindowsParameters WindowsParameters { get; set; } + + /// + /// Gets or sets input for InstallPatches on a Linux VM, as directly + /// received by the API + /// + [JsonProperty(PropertyName = "linuxParameters")] + public LinuxParameters LinuxParameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MaximumDuration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MaximumDuration"); + } + if (RebootSetting == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RebootSetting"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs new file mode 100644 index 0000000000000..53d2c65fe0274 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.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; + + /// + /// The result summary of an installation operation. + /// + public partial class VirtualMachineInstallPatchesResult + { + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesResult class. + /// + public VirtualMachineInstallPatchesResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesResult class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Failed", "Succeeded", "Unknown" or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the + /// operation that produced this result. It is used to correlate across + /// CRP and extension logs. + /// The reboot state of the VM following + /// completion of the operation. Possible values include: 'Unknown', + /// 'NotNeeded', 'Required', 'Started', 'Failed', 'Completed' + /// Whether the operation ran + /// out of time before it completed all its intended actions. + /// The number of patches that were + /// not installed due to the user blocking their installation. + /// The number of patches that were + /// detected as available for install, but did not meet the operation's + /// criteria. + /// The number of patches that were + /// identified as meeting the installation criteria, but were not able + /// to be installed. Typically this happens when + /// maintenanceWindowExceeded == true. + /// The number of patches + /// successfully installed. + /// The number of patches that could not + /// be installed due to some issue. See errors for details. + /// The patches that were installed during the + /// operation. + /// The UTC timestamp when the operation + /// began. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public VirtualMachineInstallPatchesResult(string status = default(string), string installationActivityId = default(string), string rebootStatus = default(string), bool? maintenanceWindowExceeded = default(bool?), int? excludedPatchCount = default(int?), int? notSelectedPatchCount = default(int?), int? pendingPatchCount = default(int?), int? installedPatchCount = default(int?), int? failedPatchCount = default(int?), IList patches = default(IList), System.DateTime? startDateTime = default(System.DateTime?), ApiError error = default(ApiError)) + { + Status = status; + InstallationActivityId = installationActivityId; + RebootStatus = rebootStatus; + MaintenanceWindowExceeded = maintenanceWindowExceeded; + ExcludedPatchCount = excludedPatchCount; + NotSelectedPatchCount = notSelectedPatchCount; + PendingPatchCount = pendingPatchCount; + InstalledPatchCount = installedPatchCount; + FailedPatchCount = failedPatchCount; + Patches = patches; + StartDateTime = startDateTime; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Failed", "Succeeded", "Unknown" or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "installationActivityId")] + public string InstallationActivityId { get; private set; } + + /// + /// Gets the reboot state of the VM following completion of the + /// operation. Possible values include: 'Unknown', 'NotNeeded', + /// 'Required', 'Started', 'Failed', 'Completed' + /// + [JsonProperty(PropertyName = "rebootStatus")] + public string RebootStatus { get; private set; } + + /// + /// Gets whether the operation ran out of time before it completed all + /// its intended actions. + /// + [JsonProperty(PropertyName = "maintenanceWindowExceeded")] + public bool? MaintenanceWindowExceeded { get; private set; } + + /// + /// Gets the number of patches that were not installed due to the user + /// blocking their installation. + /// + [JsonProperty(PropertyName = "excludedPatchCount")] + public int? ExcludedPatchCount { get; private set; } + + /// + /// Gets the number of patches that were detected as available for + /// install, but did not meet the operation's criteria. + /// + [JsonProperty(PropertyName = "notSelectedPatchCount")] + public int? NotSelectedPatchCount { get; private set; } + + /// + /// Gets the number of patches that were identified as meeting the + /// installation criteria, but were not able to be installed. Typically + /// this happens when maintenanceWindowExceeded == true. + /// + [JsonProperty(PropertyName = "pendingPatchCount")] + public int? PendingPatchCount { get; private set; } + + /// + /// Gets the number of patches successfully installed. + /// + [JsonProperty(PropertyName = "installedPatchCount")] + public int? InstalledPatchCount { get; private set; } + + /// + /// Gets the number of patches that could not be installed due to some + /// issue. See errors for details. + /// + [JsonProperty(PropertyName = "failedPatchCount")] + public int? FailedPatchCount { get; private set; } + + /// + /// Gets the patches that were installed during the operation. + /// + [JsonProperty(PropertyName = "patches")] + public IList Patches { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs index bc09fb9fe98cc..bd1b95c7f6352 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.Compute.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -34,10 +36,13 @@ public VirtualMachinePatchStatus() /// The installation summary /// of the latest installation operation for the virtual /// machine. - public VirtualMachinePatchStatus(AvailablePatchSummary availablePatchSummary = default(AvailablePatchSummary), LastPatchInstallationSummary lastPatchInstallationSummary = default(LastPatchInstallationSummary)) + /// The enablement status of the + /// specified patchMode + public VirtualMachinePatchStatus(AvailablePatchSummary availablePatchSummary = default(AvailablePatchSummary), LastPatchInstallationSummary lastPatchInstallationSummary = default(LastPatchInstallationSummary), IList configurationStatuses = default(IList)) { AvailablePatchSummary = availablePatchSummary; LastPatchInstallationSummary = lastPatchInstallationSummary; + ConfigurationStatuses = configurationStatuses; CustomInit(); } @@ -60,5 +65,11 @@ public VirtualMachinePatchStatus() [JsonProperty(PropertyName = "lastPatchInstallationSummary")] public LastPatchInstallationSummary LastPatchInstallationSummary { get; set; } + /// + /// Gets the enablement status of the specified patchMode + /// + [JsonProperty(PropertyName = "configurationStatuses")] + public IList ConfigurationStatuses { get; private set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs index a6592646caf39..df3fcdf217e2c 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs @@ -88,12 +88,17 @@ public VirtualMachineScaleSet() /// Specifies the scale-in policy that /// decides which virtual machines are chosen for removal when a /// Virtual Machine Scale Set is scaled-in. + /// Specifies the orchestration mode + /// for the virtual machine scale set. Possible values include: + /// 'Uniform', 'Flexible' /// The identity of the virtual machine scale /// set, if configured. /// The virtual machine scale set zones. NOTE: /// Availability zones can only be set when you create the scale /// set - public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), SubResource hostGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList)) + /// The extended location of the Virtual + /// Machine Scale Set. + public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), SubResource hostGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), OrchestrationMode? orchestrationMode = default(OrchestrationMode?), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) : base(location, id, name, type, tags) { Sku = sku; @@ -112,8 +117,10 @@ public VirtualMachineScaleSet() HostGroup = hostGroup; AdditionalCapabilities = additionalCapabilities; ScaleInPolicy = scaleInPolicy; + OrchestrationMode = orchestrationMode; Identity = identity; Zones = zones; + ExtendedLocation = extendedLocation; CustomInit(); } @@ -245,6 +252,13 @@ public VirtualMachineScaleSet() [JsonProperty(PropertyName = "properties.scaleInPolicy")] public ScaleInPolicy ScaleInPolicy { get; set; } + /// + /// Gets or sets specifies the orchestration mode for the virtual + /// machine scale set. Possible values include: 'Uniform', 'Flexible' + /// + [JsonProperty(PropertyName = "properties.orchestrationMode")] + public OrchestrationMode? OrchestrationMode { get; set; } + /// /// Gets or sets the identity of the virtual machine scale set, if /// configured. @@ -259,6 +273,13 @@ public VirtualMachineScaleSet() [JsonProperty(PropertyName = "zones")] public IList Zones { get; set; } + /// + /// Gets or sets the extended location of the Virtual Machine Scale + /// Set. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + /// /// Validate the object. /// @@ -276,6 +297,10 @@ public override void Validate() { VirtualMachineProfile.Validate(); } + if (ExtendedLocation != null) + { + ExtendedLocation.Validate(); + } } } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs index 1873c3afa8b15..681057f69d5ab 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs @@ -33,6 +33,8 @@ public VirtualMachineScaleSetUpdateVMProfile() /// /// The virtual machine scale set OS /// profile. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS /// The virtual machine scale set storage /// profile. /// The virtual machine scale set network @@ -50,9 +52,10 @@ public VirtualMachineScaleSetUpdateVMProfile() /// 2019-03-01. /// Specifies Scheduled Event /// related configurations. - public VirtualMachineScaleSetUpdateVMProfile(VirtualMachineScaleSetUpdateOSProfile osProfile = default(VirtualMachineScaleSetUpdateOSProfile), VirtualMachineScaleSetUpdateStorageProfile storageProfile = default(VirtualMachineScaleSetUpdateStorageProfile), VirtualMachineScaleSetUpdateNetworkProfile networkProfile = default(VirtualMachineScaleSetUpdateNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile)) + public VirtualMachineScaleSetUpdateVMProfile(VirtualMachineScaleSetUpdateOSProfile osProfile = default(VirtualMachineScaleSetUpdateOSProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), VirtualMachineScaleSetUpdateStorageProfile storageProfile = default(VirtualMachineScaleSetUpdateStorageProfile), VirtualMachineScaleSetUpdateNetworkProfile networkProfile = default(VirtualMachineScaleSetUpdateNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile)) { OsProfile = osProfile; + ApplicationProfile = applicationProfile; StorageProfile = storageProfile; NetworkProfile = networkProfile; SecurityProfile = securityProfile; @@ -75,6 +78,13 @@ public VirtualMachineScaleSetUpdateVMProfile() [JsonProperty(PropertyName = "osProfile")] public VirtualMachineScaleSetUpdateOSProfile OsProfile { get; set; } + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + /// /// Gets or sets the virtual machine scale set storage profile. /// 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..4d64ba5ad5819 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 @@ -48,6 +48,8 @@ public VirtualMachineScaleSetVM() /// view. /// Specifies the hardware settings for /// the virtual machine. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS /// Specifies the storage settings for the /// virtual machine disks. /// Specifies additional @@ -107,7 +109,7 @@ public VirtualMachineScaleSetVM() /// The virtual machine child extension /// resources. /// The virtual machine zones. - public VirtualMachineScaleSetVM(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string instanceId = default(string), Sku sku = default(Sku), bool? latestModelApplied = default(bool?), string vmId = default(string), VirtualMachineScaleSetVMInstanceView instanceView = default(VirtualMachineScaleSetVMInstanceView), HardwareProfile hardwareProfile = default(HardwareProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), SecurityProfile securityProfile = default(SecurityProfile), NetworkProfile networkProfile = default(NetworkProfile), VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration = default(VirtualMachineScaleSetVMNetworkProfileConfiguration), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), string provisioningState = default(string), string licenseType = default(string), string modelDefinitionApplied = default(string), VirtualMachineScaleSetVMProtectionPolicy protectionPolicy = default(VirtualMachineScaleSetVMProtectionPolicy), Plan plan = default(Plan), IList resources = default(IList), IList zones = default(IList)) + public VirtualMachineScaleSetVM(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string instanceId = default(string), Sku sku = default(Sku), bool? latestModelApplied = default(bool?), string vmId = default(string), VirtualMachineScaleSetVMInstanceView instanceView = default(VirtualMachineScaleSetVMInstanceView), HardwareProfile hardwareProfile = default(HardwareProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), SecurityProfile securityProfile = default(SecurityProfile), NetworkProfile networkProfile = default(NetworkProfile), VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration = default(VirtualMachineScaleSetVMNetworkProfileConfiguration), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), string provisioningState = default(string), string licenseType = default(string), string modelDefinitionApplied = default(string), VirtualMachineScaleSetVMProtectionPolicy protectionPolicy = default(VirtualMachineScaleSetVMProtectionPolicy), Plan plan = default(Plan), IList resources = default(IList), IList zones = default(IList)) : base(location, id, name, type, tags) { InstanceId = instanceId; @@ -116,6 +118,7 @@ public VirtualMachineScaleSetVM() VmId = vmId; InstanceView = instanceView; HardwareProfile = hardwareProfile; + ApplicationProfile = applicationProfile; StorageProfile = storageProfile; AdditionalCapabilities = additionalCapabilities; OsProfile = osProfile; @@ -177,6 +180,13 @@ public VirtualMachineScaleSetVM() [JsonProperty(PropertyName = "properties.hardwareProfile")] public HardwareProfile HardwareProfile { get; set; } + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + /// /// Gets or sets specifies the storage settings for the virtual machine /// disks. 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..fca9177e2f237 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 @@ -33,6 +33,8 @@ public VirtualMachineScaleSetVMProfile() /// /// Specifies the operating system settings for /// the virtual machines in the scale set. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS /// Specifies the storage settings for the /// virtual machine disks. /// Specifies properties of the network @@ -73,9 +75,10 @@ public VirtualMachineScaleSetVMProfile() /// 2019-03-01. /// Specifies Scheduled Event /// related configurations. - public VirtualMachineScaleSetVMProfile(VirtualMachineScaleSetOSProfile osProfile = default(VirtualMachineScaleSetOSProfile), VirtualMachineScaleSetStorageProfile storageProfile = default(VirtualMachineScaleSetStorageProfile), VirtualMachineScaleSetNetworkProfile networkProfile = default(VirtualMachineScaleSetNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile)) + public VirtualMachineScaleSetVMProfile(VirtualMachineScaleSetOSProfile osProfile = default(VirtualMachineScaleSetOSProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), VirtualMachineScaleSetStorageProfile storageProfile = default(VirtualMachineScaleSetStorageProfile), VirtualMachineScaleSetNetworkProfile networkProfile = default(VirtualMachineScaleSetNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile)) { OsProfile = osProfile; + ApplicationProfile = applicationProfile; StorageProfile = storageProfile; NetworkProfile = networkProfile; SecurityProfile = securityProfile; @@ -101,6 +104,13 @@ public VirtualMachineScaleSetVMProfile() [JsonProperty(PropertyName = "osProfile")] public VirtualMachineScaleSetOSProfile OsProfile { get; set; } + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + /// /// Gets or sets specifies the storage settings for the virtual machine /// disks. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs index 274c3f085e3c6..bc709ce1f948c 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs @@ -37,12 +37,12 @@ public VirtualMachineSoftwarePatchProperties() /// The friendly name of the patch. /// The version number of the patch. This /// property applies only to Linux patches. - /// The KBID of the patch. Only applies to Windows + /// The KBID of the patch. Only applies to Windows /// patches. /// The classification(s) of the patch as /// provided by the patch publisher. /// Describes the reboot requirements of - /// the patch. Possible values include: 'NeverReboots', + /// the patch. Possible values include: 'Unknown', 'NeverReboots', /// 'AlwaysRequiresReboot', 'CanRequestReboot' /// The activity ID of the operation that /// produced this result. It is used to correlate across CRP and @@ -51,15 +51,14 @@ public VirtualMachineSoftwarePatchProperties() /// published this patch. /// The UTC timestamp of the last /// update to this patch record. - /// Describes the outcome of an install - /// operation for a given patch. Possible values include: 'Installed', - /// 'Failed', 'Excluded', 'NotSelected', 'Pending', 'Available' - public VirtualMachineSoftwarePatchProperties(string patchId = default(string), string name = default(string), string version = default(string), string kbid = default(string), IList classifications = default(IList), string rebootBehavior = default(string), string activityId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? lastModifiedDateTime = default(System.DateTime?), string assessmentState = default(string)) + /// Describes the availability of a given + /// patch. Possible values include: 'Unknown', 'Available' + public VirtualMachineSoftwarePatchProperties(string patchId = default(string), string name = default(string), string version = default(string), string kbId = default(string), IList classifications = default(IList), string rebootBehavior = default(string), string activityId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? lastModifiedDateTime = default(System.DateTime?), string assessmentState = default(string)) { PatchId = patchId; Name = name; Version = version; - Kbid = kbid; + KbId = kbId; Classifications = classifications; RebootBehavior = rebootBehavior; ActivityId = activityId; @@ -96,8 +95,8 @@ public VirtualMachineSoftwarePatchProperties() /// /// Gets the KBID of the patch. Only applies to Windows patches. /// - [JsonProperty(PropertyName = "kbid")] - public string Kbid { get; private set; } + [JsonProperty(PropertyName = "kbId")] + public string KbId { get; private set; } /// /// Gets the classification(s) of the patch as provided by the patch @@ -108,7 +107,7 @@ public VirtualMachineSoftwarePatchProperties() /// /// Gets describes the reboot requirements of the patch. Possible - /// values include: 'NeverReboots', 'AlwaysRequiresReboot', + /// values include: 'Unknown', 'NeverReboots', 'AlwaysRequiresReboot', /// 'CanRequestReboot' /// [JsonProperty(PropertyName = "rebootBehavior")] @@ -134,9 +133,8 @@ public VirtualMachineSoftwarePatchProperties() public System.DateTime? LastModifiedDateTime { get; private set; } /// - /// Gets describes the outcome of an install operation for a given - /// patch. Possible values include: 'Installed', 'Failed', 'Excluded', - /// 'NotSelected', 'Pending', 'Available' + /// Gets describes the availability of a given patch. Possible values + /// include: 'Unknown', 'Available' /// [JsonProperty(PropertyName = "assessmentState")] public string AssessmentState { get; private set; } 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..3880a7a2c1995 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 @@ -44,6 +44,8 @@ public VirtualMachineUpdate() /// Enter any required information and then click **Save**. /// Specifies the hardware settings for /// the virtual machine. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS /// Specifies the storage settings for the /// virtual machine disks. /// Specifies additional @@ -88,6 +90,18 @@ public VirtualMachineUpdate() /// the proximity placement group that the virtual machine should be /// assigned to. <br><br>Minimum api-version: /// 2018-04-01. + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains.<br><li>This is applicable only if the + /// 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.<li>The Virtual Machine Scale Set that is referenced, + /// must have 'platformFaultDomainCount' &gt; 1.<li>This + /// property cannot be updated once the Virtual Machine is + /// created.<li>Fault domain assignment can be viewed in the + /// Virtual Machine Instance View.<br><br>Minimum + /// api‐version: 2020‐12‐01 /// Specifies the priority for the virtual /// machine. <br><br>Minimum api-version: 2019-03-01. /// Possible values include: 'Regular', 'Low', 'Spot' @@ -136,11 +150,12 @@ public VirtualMachineUpdate() /// The identity of the virtual machine, if /// configured. /// The virtual machine zones. - public VirtualMachineUpdate(IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList)) + public VirtualMachineUpdate(IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), int? platformFaultDomain = default(int?), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList)) : base(tags) { Plan = plan; HardwareProfile = hardwareProfile; + ApplicationProfile = applicationProfile; StorageProfile = storageProfile; AdditionalCapabilities = additionalCapabilities; OsProfile = osProfile; @@ -150,6 +165,7 @@ public VirtualMachineUpdate() AvailabilitySet = availabilitySet; VirtualMachineScaleSet = virtualMachineScaleSet; ProximityPlacementGroup = proximityPlacementGroup; + PlatformFaultDomain = platformFaultDomain; Priority = priority; EvictionPolicy = evictionPolicy; BillingProfile = billingProfile; @@ -189,6 +205,13 @@ public VirtualMachineUpdate() [JsonProperty(PropertyName = "properties.hardwareProfile")] public HardwareProfile HardwareProfile { get; set; } + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + /// /// Gets or sets specifies the storage settings for the virtual machine /// disks. @@ -278,6 +301,24 @@ public VirtualMachineUpdate() [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] public SubResource ProximityPlacementGroup { get; set; } + /// + /// Gets or sets specifies the scale set logical fault domain into + /// which the Virtual Machine will be created. By default, the Virtual + /// Machine will by automatically assigned to a fault domain that best + /// maintains balance across available fault + /// domains.&lt;br&gt;&lt;li&gt;This is applicable only + /// if the 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.&lt;li&gt;The Virtual Machine Scale Set that is + /// referenced, must have 'platformFaultDomainCount' &amp;gt; + /// 1.&lt;li&gt;This property cannot be updated once the + /// Virtual Machine is created.&lt;li&gt;Fault domain + /// assignment can be viewed in the Virtual Machine Instance + /// View.&lt;br&gt;&lt;br&gt;Minimum api‐version: + /// 2020‐12‐01 + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + /// /// Gets or sets specifies the priority for the virtual machine. /// &lt;br&gt;&lt;br&gt;Minimum api-version: diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsConfiguration.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsConfiguration.cs index 615ddbafcfb60..e7e53c0d01f20 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsConfiguration.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsConfiguration.cs @@ -51,11 +51,11 @@ public WindowsConfiguration() /// Specifies additional /// base-64 encoded XML formatted information that can be included in /// the Unattend.xml file, which is used by Windows Setup. - /// Specifies settings related to in-guest - /// patching (KBs). + /// Specifies settings related to VM Guest + /// Patching on Windows. /// Specifies the Windows Remote Management /// listeners. This enables remote Windows PowerShell. - public WindowsConfiguration(bool? provisionVMAgent = default(bool?), bool? enableAutomaticUpdates = default(bool?), string timeZone = default(string), IList additionalUnattendContent = default(IList), PatchSettings patchSettings = default(PatchSettings), WinRMConfiguration winRM = default(WinRMConfiguration)) + public WindowsConfiguration(bool? provisionVMAgent = default(bool?), bool? enableAutomaticUpdates = default(bool?), string timeZone = default(string), IList additionalUnattendContent = default(IList), WindowsPatchSettings patchSettings = default(WindowsPatchSettings), WinRMConfiguration winRM = default(WinRMConfiguration)) { ProvisionVMAgent = provisionVMAgent; EnableAutomaticUpdates = enableAutomaticUpdates; @@ -112,10 +112,11 @@ public WindowsConfiguration() public IList AdditionalUnattendContent { get; set; } /// - /// Gets or sets specifies settings related to in-guest patching (KBs). + /// Gets or sets specifies settings related to VM Guest Patching on + /// Windows. /// [JsonProperty(PropertyName = "patchSettings")] - public PatchSettings PatchSettings { get; set; } + public WindowsPatchSettings PatchSettings { get; set; } /// /// Gets or sets specifies the Windows Remote Management listeners. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsParameters.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsParameters.cs new file mode 100644 index 0000000000000..230533edc19de --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsParameters.cs @@ -0,0 +1,97 @@ +// +// 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; + + /// + /// Input for InstallPatches on a Windows VM, as directly received by the + /// API + /// + public partial class WindowsParameters + { + /// + /// Initializes a new instance of the WindowsParameters class. + /// + public WindowsParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsParameters class. + /// + /// The update classifications + /// to select when installing patches for Windows. + /// Kbs to include in the patch + /// operation + /// Kbs to exclude in the patch + /// operation + /// Filters out Kbs that don't + /// have an InstallationRebootBehavior of 'NeverReboots' when this is + /// set to true. + /// This is used to install patches + /// that were published on or before this given max published + /// date. + public WindowsParameters(IList classificationsToInclude = default(IList), IList kbNumbersToInclude = default(IList), IList kbNumbersToExclude = default(IList), bool? excludeKbsRequiringReboot = default(bool?), System.DateTime? maxPatchPublishDate = default(System.DateTime?)) + { + ClassificationsToInclude = classificationsToInclude; + KbNumbersToInclude = kbNumbersToInclude; + KbNumbersToExclude = kbNumbersToExclude; + ExcludeKbsRequiringReboot = excludeKbsRequiringReboot; + MaxPatchPublishDate = maxPatchPublishDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the update classifications to select when installing + /// patches for Windows. + /// + [JsonProperty(PropertyName = "classificationsToInclude")] + public IList ClassificationsToInclude { get; set; } + + /// + /// Gets or sets kbs to include in the patch operation + /// + [JsonProperty(PropertyName = "kbNumbersToInclude")] + public IList KbNumbersToInclude { get; set; } + + /// + /// Gets or sets kbs to exclude in the patch operation + /// + [JsonProperty(PropertyName = "kbNumbersToExclude")] + public IList KbNumbersToExclude { get; set; } + + /// + /// Gets or sets filters out Kbs that don't have an + /// InstallationRebootBehavior of 'NeverReboots' when this is set to + /// true. + /// + [JsonProperty(PropertyName = "excludeKbsRequiringReboot")] + public bool? ExcludeKbsRequiringReboot { get; set; } + + /// + /// Gets or sets this is used to install patches that were published on + /// or before this given max published date. + /// + [JsonProperty(PropertyName = "maxPatchPublishDate")] + public System.DateTime? MaxPatchPublishDate { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsPatchSettings.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsPatchSettings.cs new file mode 100644 index 0000000000000..fc02a235c109e --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsPatchSettings.cs @@ -0,0 +1,93 @@ +// +// 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; + + /// + /// Specifies settings related to VM Guest Patching on Windows. + /// + public partial class WindowsPatchSettings + { + /// + /// Initializes a new instance of the WindowsPatchSettings class. + /// + public WindowsPatchSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsPatchSettings class. + /// + /// Specifies the mode of VM Guest Patching to + /// IaaS virtual machine.<br /><br /> Possible values + /// are:<br /><br /> **Manual** - You control the + /// application of patches to a virtual machine. You do this by + /// applying patches manually inside the VM. In this mode, automatic + /// updates are disabled; the property + /// WindowsConfiguration.enableAutomaticUpdates must be false<br + /// /><br /> **AutomaticByOS** - The virtual machine will + /// automatically be updated by the OS. The property + /// WindowsConfiguration.enableAutomaticUpdates must be true. <br + /// /><br /> ** AutomaticByPlatform** - the virtual machine + /// will automatically updated by the platform. The properties + /// provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates + /// must be true. Possible values include: 'Manual', 'AutomaticByOS', + /// 'AutomaticByPlatform' + /// Enables customers to patch their + /// Azure VMs without requiring a reboot. For enableHotpatching, the + /// 'provisionVMAgent' must be set to true and 'patchMode' must be set + /// to 'AutomaticByPlatform'. + public WindowsPatchSettings(string patchMode = default(string), bool? enableHotpatching = default(bool?)) + { + PatchMode = patchMode; + EnableHotpatching = enableHotpatching; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mode of VM Guest Patching to IaaS + /// virtual machine.&lt;br /&gt;&lt;br /&gt; Possible + /// values are:&lt;br /&gt;&lt;br /&gt; **Manual** - + /// You control the application of patches to a virtual machine. You + /// do this by applying patches manually inside the VM. In this mode, + /// automatic updates are disabled; the property + /// WindowsConfiguration.enableAutomaticUpdates must be false&lt;br + /// /&gt;&lt;br /&gt; **AutomaticByOS** - The virtual + /// machine will automatically be updated by the OS. The property + /// WindowsConfiguration.enableAutomaticUpdates must be true. + /// &lt;br /&gt;&lt;br /&gt; ** AutomaticByPlatform** - + /// the virtual machine will automatically updated by the platform. The + /// properties provisionVMAgent and + /// WindowsConfiguration.enableAutomaticUpdates must be true. Possible + /// values include: 'Manual', 'AutomaticByOS', 'AutomaticByPlatform' + /// + [JsonProperty(PropertyName = "patchMode")] + public string PatchMode { get; set; } + + /// + /// Gets or sets enables customers to patch their Azure VMs without + /// requiring a reboot. For enableHotpatching, the 'provisionVMAgent' + /// must be set to true and 'patchMode' must be set to + /// 'AutomaticByPlatform'. + /// + [JsonProperty(PropertyName = "enableHotpatching")] + public bool? EnableHotpatching { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsVMGuestPatchMode.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsVMGuestPatchMode.cs new file mode 100644 index 0000000000000..e3c4970c7b0f3 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/WindowsVMGuestPatchMode.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 WindowsVMGuestPatchMode. + /// + public static class WindowsVMGuestPatchMode + { + public const string Manual = "Manual"; + public const string AutomaticByOS = "AutomaticByOS"; + public const string AutomaticByPlatform = "AutomaticByPlatform"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs index 53367987b6678..3e58df5747bc1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(ComputeManagementClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs index 6372cbdc612a4..5026ed7ba8236 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs @@ -105,7 +105,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -327,7 +327,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; ProximityPlacementGroupUpdate parameters = new ProximityPlacementGroupUpdate(); if (tags != null) { @@ -530,7 +530,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -710,7 +710,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -895,7 +895,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1078,7 +1078,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 3d3ee884b9171..2c057e9039d51 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 @@ -19,50 +19,44 @@ public static IEnumerable> ApiInfo_ComputeManageme { return new Tuple[] { - new Tuple("Compute", "AvailabilitySets", "2020-06-01"), - new Tuple("Compute", "DedicatedHostGroups", "2020-06-01"), - new Tuple("Compute", "DedicatedHosts", "2020-06-01"), + new Tuple("Compute", "AvailabilitySets", "2020-12-01"), + new Tuple("Compute", "DedicatedHostGroups", "2020-12-01"), + new Tuple("Compute", "DedicatedHosts", "2020-12-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", "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", "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-12-01"), + new Tuple("Compute", "LogAnalytics", "2020-12-01"), + new Tuple("Compute", "Operations", "2020-12-01"), + new Tuple("Compute", "ProximityPlacementGroups", "2020-12-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"), - new Tuple("Compute", "VirtualMachineExtensionImages", "2020-06-01"), - new Tuple("Compute", "VirtualMachineExtensions", "2020-06-01"), - new Tuple("Compute", "VirtualMachineImages", "2020-06-01"), - new Tuple("Compute", "VirtualMachineRunCommands", "2020-06-01"), - new Tuple("Compute", "VirtualMachineScaleSetExtensions", "2020-06-01"), - new Tuple("Compute", "VirtualMachineScaleSetRollingUpgrades", "2020-06-01"), - new Tuple("Compute", "VirtualMachineScaleSetVMExtensions", "2020-06-01"), - new Tuple("Compute", "VirtualMachineScaleSetVMs", "2020-06-01"), - new Tuple("Compute", "VirtualMachineScaleSets", "2020-06-01"), - new Tuple("Compute", "VirtualMachineSizes", "2020-06-01"), - new Tuple("Compute", "VirtualMachines", "2020-06-01"), + new Tuple("Compute", "SshPublicKeys", "2020-12-01"), + new Tuple("Compute", "Usage", "2020-12-01"), + new Tuple("Compute", "VirtualMachineExtensionImages", "2020-12-01"), + new Tuple("Compute", "VirtualMachineExtensions", "2020-12-01"), + new Tuple("Compute", "VirtualMachineImages", "2020-12-01"), + new Tuple("Compute", "VirtualMachineImagesEdgeZone", "2020-12-01"), + new Tuple("Compute", "VirtualMachineRunCommands", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetExtensions", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetRollingUpgrades", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMExtensions", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMs", "2020-12-01"), + new Tuple("Compute", "VirtualMachineScaleSets", "2020-12-01"), + new Tuple("Compute", "VirtualMachineSizes", "2020-12-01"), + new Tuple("Compute", "VirtualMachines", "2020-12-01"), new Tuple("ContainerService", "ContainerServices", "2017-01-31"), }.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=C:\\Users\\luwu\\Documents\\october\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "1d90950c9db002ca44a56873c5a2ea3c96f533f8"; - 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/SshPublicKeysOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperations.cs index bfb79ef0f201d..9897a18878eb1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SshPublicKeysOperations.cs @@ -81,7 +81,7 @@ internal SshPublicKeysOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -265,7 +265,7 @@ internal SshPublicKeysOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -468,7 +468,7 @@ internal SshPublicKeysOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -694,7 +694,7 @@ internal SshPublicKeysOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -892,7 +892,7 @@ internal SshPublicKeysOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1068,7 +1068,7 @@ internal SshPublicKeysOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1265,7 +1265,7 @@ internal SshPublicKeysOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs index 03b03c068a012..e0c198b712e83 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs @@ -96,7 +96,7 @@ internal UsageOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs index 61a6ba57f579f..214564a54e88a 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs @@ -106,7 +106,7 @@ internal VirtualMachineExtensionImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -303,7 +303,7 @@ internal VirtualMachineExtensionImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -505,7 +505,7 @@ internal VirtualMachineExtensionImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs index 0d80e4c732e61..8e20e220f5350 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs @@ -186,7 +186,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -390,7 +390,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -608,7 +608,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -843,7 +843,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1050,7 +1050,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperations.cs new file mode 100644 index 0000000000000..b4f675fffcaff --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperations.cs @@ -0,0 +1,1143 @@ +// +// 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; + + /// + /// VirtualMachineImagesEdgeZoneOperations operations. + /// + internal partial class VirtualMachineImagesEdgeZoneOperations : IServiceOperations, IVirtualMachineImagesEdgeZoneOperations + { + /// + /// Initializes a new instance of the VirtualMachineImagesEdgeZoneOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineImagesEdgeZoneOperations(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 virtual machine image in an edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("version", version); + 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}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _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 virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + /// + /// 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 edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("expand", expand); + tracingParameters.Add("top", top); + tracingParameters.Add("orderby", orderby); + 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}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + 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 virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// 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>> ListOffersWithHttpMessagesAsync(string location, string edgeZone, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOffers", 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}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _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 virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// 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>> ListPublishersWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPublishers", 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}/edgeZones/{edgeZone}/publishers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _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 virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// 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>> ListSkusWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", 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}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _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; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs new file mode 100644 index 0000000000000..b7c0df8deb58f --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs @@ -0,0 +1,315 @@ +// +// 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 VirtualMachineImagesEdgeZoneOperations. + /// + public static partial class VirtualMachineImagesEdgeZoneOperationsExtensions + { + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + public static VirtualMachineImage Get(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string version) + { + return operations.GetAsync(location, edgeZone, publisherName, offer, skus, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, edgeZone, publisherName, offer, skus, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + public static IList List(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string)) + { + return operations.ListAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + public static IList ListOffers(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName) + { + return operations.ListOffersAsync(location, edgeZone, publisherName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOffersAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOffersWithHttpMessagesAsync(location, edgeZone, publisherName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + public static IList ListPublishers(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone) + { + return operations.ListPublishersAsync(location, edgeZone).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPublishersAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPublishersWithHttpMessagesAsync(location, edgeZone, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + public static IList ListSkus(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer) + { + return operations.ListSkusAsync(location, edgeZone, publisherName, offer).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(location, edgeZone, publisherName, offer, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs index 3310becdc2ae0..c5580e85ffac1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs @@ -115,7 +115,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -337,7 +337,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -551,7 +551,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -739,7 +739,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -939,7 +939,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs index bd2d94937cbbd..5e21431af62e4 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs @@ -94,7 +94,7 @@ internal VirtualMachineRunCommandsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -293,7 +293,7 @@ internal VirtualMachineRunCommandsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs index a84c409c13938..597afb7122f8c 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs @@ -186,7 +186,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -387,7 +387,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -596,7 +596,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -831,7 +831,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1056,7 +1056,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs index 4259bf51041bc..6ad75c560b4cf 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs @@ -164,7 +164,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -355,7 +355,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -530,7 +530,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -705,7 +705,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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..a8fc18d075292 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs @@ -201,7 +201,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -415,7 +415,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -641,7 +641,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -885,7 +885,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1101,7 +1101,7 @@ internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient cl { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs index 7a513780a284c..496e00e7def5c 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs @@ -177,16 +177,20 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) /// /// The instance ID of the virtual machine. /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -245,7 +249,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -453,7 +457,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -656,7 +660,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -985,7 +989,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1216,7 +1220,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1432,7 +1436,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters); if (tempDisk != null) { @@ -1628,7 +1632,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1813,7 +1817,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2010,7 +2014,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2199,6 +2203,10 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) /// /// The instance ID of the virtual machine. /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// /// /// Headers that will be added to request. /// @@ -2217,7 +2225,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2235,7 +2243,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2246,6 +2254,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vmScaleSetName", vmScaleSetName); tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("forceDeletion", forceDeletion); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); @@ -2258,6 +2267,10 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); _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))); @@ -2424,7 +2437,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2611,7 +2624,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2793,7 +2806,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2976,7 +2989,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3158,7 +3171,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3354,7 +3367,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs index 41dc7e73a6056..888c670a294fa 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs @@ -240,9 +240,13 @@ public static VirtualMachineScaleSetVM Update(this IVirtualMachineScaleSetVMsOpe /// /// The instance ID of the virtual machine. /// - public static void Delete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + public static void Delete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?)) { - operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).GetAwaiter().GetResult(); } /// @@ -260,12 +264,16 @@ public static void Delete(this IVirtualMachineScaleSetVMsOperations operations, /// /// The instance ID of the virtual machine. /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1026,9 +1034,13 @@ public static VirtualMachineScaleSetVM BeginUpdate(this IVirtualMachineScaleSetV /// /// The instance ID of the virtual machine. /// - public static void BeginDelete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + public static void BeginDelete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?)) { - operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).GetAwaiter().GetResult(); } /// @@ -1046,12 +1058,16 @@ public static void BeginDelete(this IVirtualMachineScaleSetVMsOperations operati /// /// The instance ID of the virtual machine. /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs index f1a9b826a5f73..b0287372faf8b 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs @@ -50,6 +50,199 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) /// public ComputeManagementClient Client { get; private set; } + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", 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}/virtualMachineScaleSets").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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; + } + /// /// Create or update a VM scale set. /// @@ -109,16 +302,19 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) /// /// The name of the VM scale set. /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -166,7 +362,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -357,16 +553,20 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) /// /// The virtual machine scale set instance ids. /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -414,7 +614,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -601,7 +801,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -782,7 +982,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -973,7 +1173,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1167,7 +1367,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1592,7 +1792,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1792,7 +1992,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VMScaleSetConvertToSinglePlacementGroupInput parameters = new VMScaleSetConvertToSinglePlacementGroupInput(); if (activePlacementGroupId != null) { @@ -2016,7 +2216,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2242,7 +2442,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2408,6 +2608,9 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) /// /// The name of the VM scale set. /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// /// /// Headers that will be added to request. /// @@ -2426,7 +2629,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2440,7 +2643,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2450,6 +2653,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("forceDeletion", forceDeletion); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); @@ -2461,6 +2665,10 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); _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))); @@ -2620,7 +2828,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -2777,6 +2985,10 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) /// /// The virtual machine scale set instance ids. /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// /// /// Headers that will be added to request. /// @@ -2795,7 +3007,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2813,7 +3025,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); if (instanceIds != null) { @@ -2828,6 +3040,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("forceDeletion", forceDeletion); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); tracingParameters.Add("cancellationToken", cancellationToken); @@ -2840,6 +3053,10 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); _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))); @@ -3010,7 +3227,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3206,7 +3423,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3397,7 +3614,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3589,7 +3806,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3783,7 +4000,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3977,7 +4194,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); if (instanceIds != null) { @@ -4167,7 +4384,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4353,7 +4570,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -4550,7 +4767,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4689,6 +4906,180 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) return _result; } + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(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, "ListByLocationNext", 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 VM scale sets under a resource group. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs index d4f6d015812f7..ae311ab9e0c50 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs @@ -23,6 +23,42 @@ namespace Microsoft.Azure.Management.Compute /// public static partial class VirtualMachineScaleSetsOperationsExtensions { + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + public static IPage ListByLocation(this IVirtualMachineScaleSetsOperations operations, string location) + { + return operations.ListByLocationAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IVirtualMachineScaleSetsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Create or update a VM scale set. /// @@ -127,9 +163,12 @@ public static VirtualMachineScaleSet Update(this IVirtualMachineScaleSetsOperati /// /// The name of the VM scale set. /// - public static void Delete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + public static void Delete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?)) { - operations.DeleteAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).GetAwaiter().GetResult(); } /// @@ -144,12 +183,15 @@ public static void Delete(this IVirtualMachineScaleSetsOperations operations, st /// /// The name of the VM scale set. /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -258,9 +300,13 @@ public static VirtualMachineScaleSet Get(this IVirtualMachineScaleSetsOperations /// /// The virtual machine scale set instance ids. /// - public static void DeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds) + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + public static void DeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?)) { - operations.DeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + operations.DeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion).GetAwaiter().GetResult(); } /// @@ -278,12 +324,16 @@ public static void DeleteInstances(this IVirtualMachineScaleSetsOperations opera /// /// The virtual machine scale set instance ids. /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// /// /// The cancellation token. /// - public static async Task DeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1120,9 +1170,12 @@ public static VirtualMachineScaleSet BeginUpdate(this IVirtualMachineScaleSetsOp /// /// The name of the VM scale set. /// - public static void BeginDelete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + public static void BeginDelete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?)) { - operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).GetAwaiter().GetResult(); } /// @@ -1137,12 +1190,15 @@ public static void BeginDelete(this IVirtualMachineScaleSetsOperations operation /// /// The name of the VM scale set. /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1211,9 +1267,13 @@ public static void BeginDelete(this IVirtualMachineScaleSetsOperations operation /// /// The virtual machine scale set instance ids. /// - public static void BeginDeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds) + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + public static void BeginDeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?)) { - operations.BeginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + operations.BeginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion).GetAwaiter().GetResult(); } /// @@ -1231,12 +1291,16 @@ public static void BeginDeleteInstances(this IVirtualMachineScaleSetsOperations /// /// The virtual machine scale set instance ids. /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// /// /// The cancellation token. /// - public static async Task BeginDeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1680,6 +1744,42 @@ public static void BeginSetOrchestrationServiceState(this IVirtualMachineScaleSe (await operations.BeginSetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets a list of all VM scale sets under a resource group. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs index 92ec0f79c93e0..11ae9680fcb11 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs @@ -95,7 +95,7 @@ internal VirtualMachineSizesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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..e722b9908b881 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs @@ -95,7 +95,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,16 +329,19 @@ internal VirtualMachinesOperations(ComputeManagementClient client) /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// /// /// 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); } @@ -391,7 +394,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -590,7 +593,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -833,7 +836,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1003,7 +1006,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1186,7 +1189,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1382,7 +1385,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1728,7 +1731,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1946,7 +1949,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2100,6 +2103,31 @@ internal VirtualMachinesOperations(ComputeManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> InstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Run command on the VM. /// @@ -2181,7 +2209,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2394,7 +2422,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2620,7 +2648,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2710,7 +2738,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2770,24 +2798,6 @@ internal VirtualMachinesOperations(ComputeManagementClient client) 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); @@ -2804,6 +2814,9 @@ internal VirtualMachinesOperations(ComputeManagementClient client) /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// /// /// Headers that will be added to request. /// @@ -2822,7 +2835,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) { @@ -2836,7 +2849,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2846,6 +2859,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 +2871,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))); @@ -3010,7 +3028,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3184,7 +3202,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3364,7 +3382,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3542,7 +3560,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3715,7 +3733,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3888,7 +3906,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4062,7 +4080,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4241,7 +4259,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters); if (tempDisk != null) { @@ -4427,7 +4445,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4603,7 +4621,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4753,6 +4771,218 @@ internal VirtualMachinesOperations(ComputeManagementClient client) return _result; } + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// 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> BeginInstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (installPatchesInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "installPatchesInput"); + } + if (installPatchesInput != null) + { + installPatchesInput.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("installPatchesInput", installPatchesInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginInstallPatches", 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/virtualMachines/{vmName}/installPatches").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _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(installPatchesInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(installPatchesInput, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Run command on the VM. /// @@ -4808,7 +5038,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-06-01"; + string apiVersion = "2020-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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..1c7bc104a93cf 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.(Feature in Preview) + /// + 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.(Feature in Preview) + /// /// /// 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(); } /// @@ -987,6 +993,52 @@ public static VirtualMachineAssessPatchesResult AssessPatches(this IVirtualMachi } } + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + public static VirtualMachineInstallPatchesResult InstallPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput) + { + return operations.InstallPatchesAsync(resourceGroupName, vmName, installPatchesInput).GetAwaiter().GetResult(); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The cancellation token. + /// + public static async Task InstallPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Run command on the VM. /// @@ -1187,9 +1239,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.(Feature in Preview) + /// + 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 +1259,15 @@ public static void BeginDelete(this IVirtualMachinesOperations operations, strin /// /// The name of the virtual machine. /// + /// + /// Optional parameter to force delete virtual machines.(Feature in Preview) + /// /// /// 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(); } /// @@ -1617,6 +1675,52 @@ public static VirtualMachineAssessPatchesResult BeginAssessPatches(this IVirtual } } + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + public static VirtualMachineInstallPatchesResult BeginInstallPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput) + { + return operations.BeginInstallPatchesAsync(resourceGroupName, vmName, installPatchesInput).GetAwaiter().GetResult(); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The cancellation token. + /// + public static async Task BeginInstallPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginInstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Run command on the VM. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMAutoPatchSettingTests.cs b/sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMAutoPatchSettingTests.cs index c427132ea20e6..4bd0693957452 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMAutoPatchSettingTests.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMAutoPatchSettingTests.cs @@ -53,7 +53,7 @@ private void StartPatchSettingTest(MockContext context, string patchSettingMode, // The following variables are defined here to allow validation string autoLogonContent = null; - var patchSetting = new PatchSettings + var patchSetting = new WindowsPatchSettings { PatchMode = patchSettingMode }; @@ -141,7 +141,7 @@ private static string GetAutoLogonContent(uint logonCount, string userName, stri "", logonCount, userName, password); } - private void SetWindowsConfigurationPatchSettings(PatchSettings patchSetting, bool enableAutomaticUpdates, string autoLogonContent, VirtualMachine inputVM) + private void SetWindowsConfigurationPatchSettings(WindowsPatchSettings patchSetting, bool enableAutomaticUpdates, string autoLogonContent, VirtualMachine inputVM) { var osProfile = inputVM.OsProfile; osProfile.WindowsConfiguration = new WindowsConfiguration diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/tests/SessionRecords/VMScaleSetScenarioTests/TestVMScaleSetScenarioOperations.json b/sdk/compute/Microsoft.Azure.Management.Compute/tests/SessionRecords/VMScaleSetScenarioTests/TestVMScaleSetScenarioOperations.json index 178a1f83601e2..4f1e9b8c1ed53 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/tests/SessionRecords/VMScaleSetScenarioTests/TestVMScaleSetScenarioOperations.json +++ b/sdk/compute/Microsoft.Azure.Management.Compute/tests/SessionRecords/VMScaleSetScenarioTests/TestVMScaleSetScenarioOperations.json @@ -1,59 +1,59 @@ { "Entries": [ { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/SoutheastAsia/publishers/MicrosoftWindowsServer/artifacttypes/vmimage/offers/WindowsServer/skus/2012-R2-Datacenter/versions?$top=1&api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvU291dGhlYXN0QXNpYS9wdWJsaXNoZXJzL01pY3Jvc29mdFdpbmRvd3NTZXJ2ZXIvYXJ0aWZhY3R0eXBlcy92bWltYWdlL29mZmVycy9XaW5kb3dzU2VydmVyL3NrdXMvMjAxMi1SMi1EYXRhY2VudGVyL3ZlcnNpb25zPyR0b3A9MSZhcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/SoutheastAsia/publishers/MicrosoftWindowsServer/artifacttypes/vmimage/offers/WindowsServer/skus/2012-R2-Datacenter/versions?$top=1&api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvU291dGhlYXN0QXNpYS9wdWJsaXNoZXJzL01pY3Jvc29mdFdpbmRvd3NTZXJ2ZXIvYXJ0aWZhY3R0eXBlcy92bWltYWdlL29mZmVycy9XaW5kb3dzU2VydmVyL3NrdXMvMjAxMi1SMi1EYXRhY2VudGVyL3ZlcnNpb25zPyR0b3A9MSZhcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "62a7f2a2-b1ea-4ef6-91a0-cbaa532811f2" + "9b55c19c-6440-4467-a692-ae862694d8d1" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:51:19 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-served-by": [ - "9fc414ea-410e-4600-9f7c-71bc36416f3f_132350705073767747" + "9fc414ea-410e-4600-9f7c-71bc36416f3f_132524702198017070" ], "x-ms-request-id": [ - "2497d1da-b0bc-48af-80d0-ca7d32c40d7d" + "69bf2c68-d15e-4978-8c1d-aba2394098a8" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11998" + "11999" ], "x-ms-correlation-request-id": [ - "e3e053bb-b39b-4ed4-9f04-84f0608c2a4e" + "80a60407-21f7-4361-a3c8-489876362fc0" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175120Z:e3e053bb-b39b-4ed4-9f04-84f0608c2a4e" + "WESTCENTRALUS:20201216T234753Z:80a60407-21f7-4361-a3c8-489876362fc0" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:47:53 GMT" + ], "Content-Length": [ "321" ], @@ -64,25 +64,25 @@ "-1" ] }, - "ResponseBody": "[\r\n {\r\n \"location\": \"southeastasia\",\r\n \"name\": \"4.127.20180315\",\r\n \"id\": \"/Subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/Providers/Microsoft.Compute/Locations/southeastasia/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2012-R2-Datacenter/Versions/4.127.20180315\"\r\n }\r\n]", + "ResponseBody": "[\r\n {\r\n \"location\": \"southeastasia\",\r\n \"name\": \"4.127.20180315\",\r\n \"id\": \"/Subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/Providers/Microsoft.Compute/Locations/southeastasia/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2012-R2-Datacenter/Versions/4.127.20180315\"\r\n }\r\n]", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourcegroups/crptestar8659?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlZ3JvdXBzL2NycHRlc3Rhcjg2NTk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourcegroups/crptestar6252?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlZ3JvdXBzL2NycHRlc3RhcjYyNTI/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"crptestar8659\": \"2020-06-12 17:51:20Z\"\r\n }\r\n}", + "RequestBody": "{\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"crptestar6252\": \"2020-12-16 23:47:53Z\"\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "8a6eb1b1-d656-42d2-8497-89a1721cbce5" + "f681b999-0c96-4a1a-8469-ed755a1dae88" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ], "Content-Type": [ @@ -96,9 +96,6 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:51:20 GMT" - ], "Pragma": [ "no-cache" ], @@ -106,13 +103,13 @@ "1199" ], "x-ms-request-id": [ - "9a1ca1ac-6477-4ca6-9186-9d8cee5c5bc5" + "decf7626-d4dd-4736-966e-638796565c11" ], "x-ms-correlation-request-id": [ - "9a1ca1ac-6477-4ca6-9186-9d8cee5c5bc5" + "decf7626-d4dd-4736-966e-638796565c11" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175121Z:9a1ca1ac-6477-4ca6-9186-9d8cee5c5bc5" + "WESTUS:20201216T234756Z:decf7626-d4dd-4736-966e-638796565c11" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -120,6 +117,9 @@ "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:47:55 GMT" + ], "Content-Length": [ "234" ], @@ -130,25 +130,25 @@ "-1" ] }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659\",\r\n \"name\": \"crptestar8659\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"crptestar8659\": \"2020-06-12 17:51:20Z\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252\",\r\n \"name\": \"crptestar6252\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"crptestar6252\": \"2020-12-16 23:47:53Z\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourcegroups/crptestar8659?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlZ3JvdXBzL2NycHRlc3Rhcjg2NTk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourcegroups/crptestar6252?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlZ3JvdXBzL2NycHRlc3RhcjYyNTI/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", "RequestMethod": "PUT", "RequestBody": "{\r\n \"location\": \"SoutheastAsia\"\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "6f4cefc3-8cbc-4053-aef0-714e1f5410c3" + "ff6067c6-2364-4e13-aeef-5585c8e8b1ed" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ], "Content-Type": [ @@ -162,9 +162,6 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:00 GMT" - ], "Pragma": [ "no-cache" ], @@ -172,13 +169,13 @@ "1198" ], "x-ms-request-id": [ - "06eabfdc-70d9-448b-9e4f-0aa49846dc7a" + "9f65d66e-436b-4aa7-9c0e-e9284a63a84c" ], "x-ms-correlation-request-id": [ - "06eabfdc-70d9-448b-9e4f-0aa49846dc7a" + "9f65d66e-436b-4aa7-9c0e-e9284a63a84c" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175200Z:06eabfdc-70d9-448b-9e4f-0aa49846dc7a" + "WESTUS:20201216T234834Z:9f65d66e-436b-4aa7-9c0e-e9284a63a84c" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -186,6 +183,9 @@ "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:33 GMT" + ], "Content-Length": [ "186" ], @@ -196,25 +196,25 @@ "-1" ] }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659\",\r\n \"name\": \"crptestar8659\",\r\n \"location\": \"southeastasia\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252\",\r\n \"name\": \"crptestar6252\",\r\n \"location\": \"southeastasia\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Storage/storageAccounts/crptestar7891?api-version=2015-06-15", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5TdG9yYWdlL3N0b3JhZ2VBY2NvdW50cy9jcnB0ZXN0YXI3ODkxP2FwaS12ZXJzaW9uPTIwMTUtMDYtMTU=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Storage/storageAccounts/crptestar2747?api-version=2015-06-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5TdG9yYWdlL3N0b3JhZ2VBY2NvdW50cy9jcnB0ZXN0YXIyNzQ3P2FwaS12ZXJzaW9uPTIwMTUtMDYtMTU=", "RequestMethod": "PUT", "RequestBody": "{\r\n \"location\": \"SoutheastAsia\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_GRS\"\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "6e35005a-00d6-40e2-a7d2-fff251b9bbfe" + "2462c450-0a3a-4490-a3a3-760678fdb6ed" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Storage.StorageManagementClient/4.0.0.0" ], "Content-Type": [ @@ -228,125 +228,62 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:51:27 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Storage/locations/southeastasia/asyncoperations/191d386f-a7c1-48b5-ac45-231cc7662ba8?monitor=true&api-version=2015-06-15" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Storage/locations/southeastasia/asyncoperations/87e48aa0-da85-4f2e-9271-a3ec9c25a809?monitor=true&api-version=2015-06-15" ], "Retry-After": [ "17" ], - "Server": [ - "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "191d386f-a7c1-48b5-ac45-231cc7662ba8" + "87e48aa0-da85-4f2e-9271-a3ec9c25a809" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], "x-ms-correlation-request-id": [ - "59de1b82-8c69-43e6-86fe-be324db8cfd4" + "9605b8ba-a88d-4885-8083-9e2a5f1171eb" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175128Z:59de1b82-8c69-43e6-86fe-be324db8cfd4" + "WESTUS:20201216T234804Z:9605b8ba-a88d-4885-8083-9e2a5f1171eb" ], "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Wed, 16 Dec 2020 23:48:03 GMT" ], "Content-Type": [ "text/plain; charset=utf-8" ], "Expires": [ "-1" - ] - }, - "ResponseBody": "", - "StatusCode": 202 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Storage/locations/southeastasia/asyncoperations/191d386f-a7c1-48b5-ac45-231cc7662ba8?monitor=true&api-version=2015-06-15", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9hc3luY29wZXJhdGlvbnMvMTkxZDM4NmYtYTdjMS00OGI1LWFjNDUtMjMxY2M3NjYyYmE4P21vbml0b3I9dHJ1ZSZhcGktdmVyc2lvbj0yMDE1LTA2LTE1", - "RequestMethod": "GET", - "RequestBody": "", - "RequestHeaders": { - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Storage.StorageManagementClient/4.0.0.0" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 17:51:44 GMT" - ], - "Pragma": [ - "no-cache" - ], - "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Storage/locations/southeastasia/asyncoperations/191d386f-a7c1-48b5-ac45-231cc7662ba8?monitor=true&api-version=2015-06-15" - ], - "Retry-After": [ - "3" - ], - "Server": [ - "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" - ], - "x-ms-request-id": [ - "ee62c2b9-a084-4309-a72b-a52bedb51327" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" - ], - "x-ms-correlation-request-id": [ - "a6455adb-6a77-4150-92fc-426bc08a76a2" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T175145Z:a6455adb-6a77-4150-92fc-426bc08a76a2" - ], - "X-Content-Type-Options": [ - "nosniff" ], "Content-Length": [ "0" - ], - "Content-Type": [ - "text/plain; charset=utf-8" - ], - "Expires": [ - "-1" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Storage/locations/southeastasia/asyncoperations/191d386f-a7c1-48b5-ac45-231cc7662ba8?monitor=true&api-version=2015-06-15", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9hc3luY29wZXJhdGlvbnMvMTkxZDM4NmYtYTdjMS00OGI1LWFjNDUtMjMxY2M3NjYyYmE4P21vbml0b3I9dHJ1ZSZhcGktdmVyc2lvbj0yMDE1LTA2LTE1", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Storage/locations/southeastasia/asyncoperations/87e48aa0-da85-4f2e-9271-a3ec9c25a809?monitor=true&api-version=2015-06-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9hc3luY29wZXJhdGlvbnMvODdlNDhhYTAtZGE4NS00ZjJlLTkyNzEtYTNlYzljMjVhODA5P21vbml0b3I9dHJ1ZSZhcGktdmVyc2lvbj0yMDE1LTA2LTE1", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Storage.StorageManagementClient/4.0.0.0" ] }, @@ -354,33 +291,33 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:51:47 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "a9f25e42-cc3e-4809-975e-d4f7e2f84b46" + "fa6b166d-13cd-4a9a-9354-e011269633e8" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11998" + "11999" ], "x-ms-correlation-request-id": [ - "81f50b43-d1eb-4e5d-bb1f-347017dd4004" + "b2537ccd-95cf-45ec-8e62-8ff0216e9909" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175148Z:81f50b43-d1eb-4e5d-bb1f-347017dd4004" + "WESTUS:20201216T234821Z:b2537ccd-95cf-45ec-8e62-8ff0216e9909" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:21 GMT" + ], "Content-Length": [ "95" ], @@ -395,21 +332,21 @@ "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Storage/storageAccounts?api-version=2015-06-15", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5TdG9yYWdlL3N0b3JhZ2VBY2NvdW50cz9hcGktdmVyc2lvbj0yMDE1LTA2LTE1", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Storage/storageAccounts?api-version=2015-06-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5TdG9yYWdlL3N0b3JhZ2VBY2NvdW50cz9hcGktdmVyc2lvbj0yMDE1LTA2LTE1", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "37835b15-4047-4cd1-931e-d6e447bd51a6" + "0c7ab85c-b7d8-470a-a64a-7862574466bf" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Storage.StorageManagementClient/4.0.0.0" ] }, @@ -417,33 +354,33 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:51:58 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "8409b6a3-bcb5-4534-afd8-0bf0d6239b15" + "35537826-dd5d-44ea-8774-6e249be73bfe" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11997" + "11998" ], "x-ms-correlation-request-id": [ - "36ab0e0c-f1c1-4027-b2ad-b50cb1a6bd09" + "0a463c9a-e81e-4155-a055-62ff0d27bc73" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175158Z:36ab0e0c-f1c1-4027-b2ad-b50cb1a6bd09" + "WESTUS:20201216T234832Z:0a463c9a-e81e-4155-a055-62ff0d27bc73" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:32 GMT" + ], "Content-Length": [ "752" ], @@ -454,25 +391,25 @@ "-1" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Storage/storageAccounts/crptestar7891\",\r\n \"name\": \"crptestar7891\",\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"accountType\": \"Standard_GRS\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"creationTime\": \"2020-06-12T17:51:26.6703531Z\",\r\n \"primaryEndpoints\": {\r\n \"blob\": \"https://crptestar7891.blob.core.windows.net/\",\r\n \"queue\": \"https://crptestar7891.queue.core.windows.net/\",\r\n \"table\": \"https://crptestar7891.table.core.windows.net/\",\r\n \"file\": \"https://crptestar7891.file.core.windows.net/\"\r\n },\r\n \"primaryLocation\": \"southeastasia\",\r\n \"statusOfPrimary\": \"available\",\r\n \"secondaryLocation\": \"eastasia\",\r\n \"statusOfSecondary\": \"available\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Storage/storageAccounts/crptestar2747\",\r\n \"name\": \"crptestar2747\",\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"accountType\": \"Standard_GRS\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"creationTime\": \"2020-12-16T23:48:03.2281118Z\",\r\n \"primaryEndpoints\": {\r\n \"blob\": \"https://crptestar2747.blob.core.windows.net/\",\r\n \"queue\": \"https://crptestar2747.queue.core.windows.net/\",\r\n \"table\": \"https://crptestar2747.table.core.windows.net/\",\r\n \"file\": \"https://crptestar2747.file.core.windows.net/\"\r\n },\r\n \"primaryLocation\": \"southeastasia\",\r\n \"statusOfPrimary\": \"available\",\r\n \"secondaryLocation\": \"eastasia\",\r\n \"statusOfSecondary\": \"available\"\r\n }\r\n }\r\n ]\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Storage/storageAccounts/crptestar7891?api-version=2015-06-15", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5TdG9yYWdlL3N0b3JhZ2VBY2NvdW50cy9jcnB0ZXN0YXI3ODkxP2FwaS12ZXJzaW9uPTIwMTUtMDYtMTU=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Storage/storageAccounts/crptestar2747?api-version=2015-06-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5TdG9yYWdlL3N0b3JhZ2VBY2NvdW50cy9jcnB0ZXN0YXIyNzQ3P2FwaS12ZXJzaW9uPTIwMTUtMDYtMTU=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "45b4f7c5-b65b-4d65-aa18-2661c38f319e" + "b9984127-bc00-42a6-9d8f-ab5698302d60" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Storage.StorageManagementClient/4.0.0.0" ] }, @@ -480,33 +417,33 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:51:58 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "e40ecd4c-254f-475d-a861-12ea7139cd29" + "f747c23a-eeae-4b43-9933-f484efd068cd" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11996" + "11997" ], "x-ms-correlation-request-id": [ - "3b85eefc-a30c-491f-b39f-93a29f7201f5" + "e908cfd0-bfc0-42b0-8fbb-9d74e8dde4ef" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175158Z:3b85eefc-a30c-491f-b39f-93a29f7201f5" + "WESTUS:20201216T234832Z:e908cfd0-bfc0-42b0-8fbb-9d74e8dde4ef" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:32 GMT" + ], "Content-Length": [ "740" ], @@ -517,35 +454,32 @@ "-1" ] }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Storage/storageAccounts/crptestar7891\",\r\n \"name\": \"crptestar7891\",\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"accountType\": \"Standard_GRS\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"creationTime\": \"2020-06-12T17:51:26.6703531Z\",\r\n \"primaryEndpoints\": {\r\n \"blob\": \"https://crptestar7891.blob.core.windows.net/\",\r\n \"queue\": \"https://crptestar7891.queue.core.windows.net/\",\r\n \"table\": \"https://crptestar7891.table.core.windows.net/\",\r\n \"file\": \"https://crptestar7891.file.core.windows.net/\"\r\n },\r\n \"primaryLocation\": \"southeastasia\",\r\n \"statusOfPrimary\": \"available\",\r\n \"secondaryLocation\": \"eastasia\",\r\n \"statusOfSecondary\": \"available\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Storage/storageAccounts/crptestar2747\",\r\n \"name\": \"crptestar2747\",\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"accountType\": \"Standard_GRS\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"creationTime\": \"2020-12-16T23:48:03.2281118Z\",\r\n \"primaryEndpoints\": {\r\n \"blob\": \"https://crptestar2747.blob.core.windows.net/\",\r\n \"queue\": \"https://crptestar2747.queue.core.windows.net/\",\r\n \"table\": \"https://crptestar2747.table.core.windows.net/\",\r\n \"file\": \"https://crptestar2747.file.core.windows.net/\"\r\n },\r\n \"primaryLocation\": \"southeastasia\",\r\n \"statusOfPrimary\": \"available\",\r\n \"secondaryLocation\": \"eastasia\",\r\n \"statusOfSecondary\": \"available\"\r\n }\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/VMScaleSetDoesNotExist?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL1ZNU2NhbGVTZXREb2VzTm90RXhpc3Q/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/VMScaleSetDoesNotExist?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL1ZNU2NhbGVTZXREb2VzTm90RXhpc3Q/YXBpLXZlcnNpb249MjAyMC0xMi0wMQ==", "RequestMethod": "DELETE", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "1eb747c6-54ce-4770-82e2-31464aa0c718" + "6662b0fd-1bcf-425e-b480-972c743bf8df" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:51:59 GMT" - ], "Pragma": [ "no-cache" ], @@ -553,13 +487,13 @@ "14999" ], "x-ms-request-id": [ - "39997039-9406-49b6-a601-99e8a0611da1" + "d856c1c6-843e-4a21-8637-8d34bff2bb24" ], "x-ms-correlation-request-id": [ - "39997039-9406-49b6-a601-99e8a0611da1" + "d856c1c6-843e-4a21-8637-8d34bff2bb24" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175159Z:39997039-9406-49b6-a601-99e8a0611da1" + "WESTCENTRALUS:20201216T234833Z:d856c1c6-843e-4a21-8637-8d34bff2bb24" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -567,6 +501,9 @@ "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:33 GMT" + ], "Expires": [ "-1" ] @@ -575,74 +512,74 @@ "StatusCode": 204 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/publicIPAddresses/pip583?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3B1YmxpY0lQQWRkcmVzc2VzL3BpcDU4Mz9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/publicIPAddresses/pip9997?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3B1YmxpY0lQQWRkcmVzc2VzL3BpcDk5OTc/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"properties\": {\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn4901\"\r\n }\r\n },\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n }\r\n}", + "RequestBody": "{\r\n \"properties\": {\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn745\"\r\n }\r\n },\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "91f5331d-195b-4861-b84c-720b6959a14a" + "6c9c007c-e674-4e04-b5ff-9f5417c6b79a" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ], "Content-Type": [ "application/json; charset=utf-8" ], "Content-Length": [ - "207" + "206" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:06 GMT" - ], "Pragma": [ "no-cache" ], "Retry-After": [ "1" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "dd136fb7-6523-486f-8386-af3ce305ff0b" + "29d2e0bc-00b7-4d1f-b6d5-4c12bc5f2c69" ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Network/locations/southeastasia/operations/dd136fb7-6523-486f-8386-af3ce305ff0b?api-version=2019-09-01" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Network/locations/southeastasia/operations/29d2e0bc-00b7-4d1f-b6d5-4c12bc5f2c69?api-version=2019-09-01" ], "x-ms-correlation-request-id": [ - "c91eeea5-391f-4486-8dc0-2e7518c8464d" + "954635ab-4775-428c-a86a-16035688acec" ], "Azure-AsyncNotification": [ "Enabled" ], "x-ms-arm-service-request-id": [ - "4085d395-ca36-443e-9e6c-3d2152ea28ab" + "ef4eaf3e-6699-4355-a068-9f468184c014" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175207Z:c91eeea5-391f-4486-8dc0-2e7518c8464d" + "WESTUS:20201216T234844Z:954635ab-4775-428c-a86a-16035688acec" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:43 GMT" + ], "Content-Length": [ "767" ], @@ -653,19 +590,19 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"pip583\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/publicIPAddresses/pip583\",\r\n \"etag\": \"W/\\\"ff88dc9c-a26f-478f-ba9f-2589d6dac11a\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"c9052c50-4ad0-4aa5-914f-444e7cf73479\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn4901\",\r\n \"fqdn\": \"dn4901.southeastasia.cloudapp.azure.com\"\r\n },\r\n \"ipTags\": []\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"name\": \"pip9997\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/publicIPAddresses/pip9997\",\r\n \"etag\": \"W/\\\"d7f31bec-caa3-4076-ad01-022130d83bdc\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"f37e9e8e-8e1d-4d39-8886-9af0c4f92ecf\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn745\",\r\n \"fqdn\": \"dn745.southeastasia.cloudapp.azure.com\"\r\n },\r\n \"ipTags\": []\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Network/locations/southeastasia/operations/dd136fb7-6523-486f-8386-af3ce305ff0b?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RkMTM2ZmI3LTY1MjMtNDg2Zi04Mzg2LWFmM2NlMzA1ZmYwYj9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Network/locations/southeastasia/operations/29d2e0bc-00b7-4d1f-b6d5-4c12bc5f2c69?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzI5ZDJlMGJjLTAwYjctNGQxZi1iNmQ1LTRjMTJiYzVmMmM2OT9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -673,37 +610,37 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:08 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "e5640b57-1d56-4fc9-877c-4933b7cfb677" + "82708409-e087-4317-b866-b1762eb7c926" ], "x-ms-correlation-request-id": [ - "9aa9e741-0741-4b43-b187-6c139c6886d2" + "f205484d-77c7-4a60-a2bc-334c68d0a33d" ], "x-ms-arm-service-request-id": [ - "1d0b0a4b-b445-4031-986e-e4c6a33cca8e" + "077f06f9-c25a-438e-b36b-7d41e58746ee" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175209Z:9aa9e741-0741-4b43-b187-6c139c6886d2" + "WESTUS:20201216T234845Z:f205484d-77c7-4a60-a2bc-334c68d0a33d" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:45 GMT" + ], "Content-Length": [ "29" ], @@ -718,15 +655,15 @@ "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/publicIPAddresses/pip583?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3B1YmxpY0lQQWRkcmVzc2VzL3BpcDU4Mz9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/publicIPAddresses/pip9997?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3B1YmxpY0lQQWRkcmVzc2VzL3BpcDk5OTc/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -734,40 +671,40 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:08 GMT" - ], "Pragma": [ "no-cache" ], "ETag": [ - "W/\"34ac8097-6851-42f7-b36c-7a7a8621ddc7\"" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "W/\"5cd7fed8-b052-46b6-939f-a97c14e0448c\"" ], "x-ms-request-id": [ - "0324b8b5-aad5-4bbe-be7b-a28081df86df" + "bbb71436-ccc1-4507-adcd-ea73a877fa39" ], "x-ms-correlation-request-id": [ - "2e57f17d-3306-41d8-93cb-3dc8974ef70e" + "817c2440-2d0f-4465-849c-5ee1b8568c7f" ], "x-ms-arm-service-request-id": [ - "cd1107ae-b93d-4b9b-8bd2-d259a1397711" + "a9c052ac-6216-421f-b921-0e5b9b6f32bc" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175209Z:2e57f17d-3306-41d8-93cb-3dc8974ef70e" + "WESTUS:20201216T234846Z:817c2440-2d0f-4465-849c-5ee1b8568c7f" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:45 GMT" + ], "Content-Length": [ "768" ], @@ -778,25 +715,25 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"pip583\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/publicIPAddresses/pip583\",\r\n \"etag\": \"W/\\\"34ac8097-6851-42f7-b36c-7a7a8621ddc7\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"c9052c50-4ad0-4aa5-914f-444e7cf73479\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn4901\",\r\n \"fqdn\": \"dn4901.southeastasia.cloudapp.azure.com\"\r\n },\r\n \"ipTags\": []\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"name\": \"pip9997\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/publicIPAddresses/pip9997\",\r\n \"etag\": \"W/\\\"5cd7fed8-b052-46b6-939f-a97c14e0448c\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"f37e9e8e-8e1d-4d39-8886-9af0c4f92ecf\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn745\",\r\n \"fqdn\": \"dn745.southeastasia.cloudapp.azure.com\"\r\n },\r\n \"ipTags\": []\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/publicIPAddresses/pip583?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3B1YmxpY0lQQWRkcmVzc2VzL3BpcDU4Mz9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/publicIPAddresses/pip9997?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3B1YmxpY0lQQWRkcmVzc2VzL3BpcDk5OTc/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "53abadc8-ae91-45a3-9af3-7d7ab069ff53" + "18d8f5ec-0ea7-4ffc-97bb-e608ee114a28" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -804,40 +741,40 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:09 GMT" - ], "Pragma": [ "no-cache" ], "ETag": [ - "W/\"34ac8097-6851-42f7-b36c-7a7a8621ddc7\"" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "W/\"5cd7fed8-b052-46b6-939f-a97c14e0448c\"" ], "x-ms-request-id": [ - "1fa759fe-77c2-4e59-818b-75958bc99bd5" + "05aa4585-f4ef-43f7-a0cc-91ad0552c23a" ], "x-ms-correlation-request-id": [ - "c2201a88-ef84-4d45-b602-9c6b12de850b" + "c6b143de-68bc-40d5-beb7-054b5ebee540" ], "x-ms-arm-service-request-id": [ - "d59eebab-7dcc-466e-a8cb-41495300e68e" + "74cb35c1-8da2-479c-a546-2e0682bee232" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175210Z:c2201a88-ef84-4d45-b602-9c6b12de850b" + "WESTUS:20201216T234846Z:c6b143de-68bc-40d5-beb7-054b5ebee540" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:45 GMT" + ], "Content-Length": [ "768" ], @@ -848,25 +785,25 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"pip583\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/publicIPAddresses/pip583\",\r\n \"etag\": \"W/\\\"34ac8097-6851-42f7-b36c-7a7a8621ddc7\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"c9052c50-4ad0-4aa5-914f-444e7cf73479\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn4901\",\r\n \"fqdn\": \"dn4901.southeastasia.cloudapp.azure.com\"\r\n },\r\n \"ipTags\": []\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"name\": \"pip9997\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/publicIPAddresses/pip9997\",\r\n \"etag\": \"W/\\\"5cd7fed8-b052-46b6-939f-a97c14e0448c\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"f37e9e8e-8e1d-4d39-8886-9af0c4f92ecf\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"dnsSettings\": {\r\n \"domainNameLabel\": \"dn745\",\r\n \"fqdn\": \"dn745.southeastasia.cloudapp.azure.com\"\r\n },\r\n \"ipTags\": []\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxOZXR3b3Jrcy92bjgxOTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxOZXR3b3Jrcy92bjkzMTc/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"properties\": {\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": [\r\n \"10.1.1.1\",\r\n \"10.1.2.4\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"properties\": {\r\n \"addressPrefix\": \"10.0.0.0/24\"\r\n },\r\n \"name\": \"sn5318\"\r\n }\r\n ]\r\n },\r\n \"location\": \"SoutheastAsia\"\r\n}", + "RequestBody": "{\r\n \"properties\": {\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": [\r\n \"10.1.1.1\",\r\n \"10.1.2.4\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"properties\": {\r\n \"addressPrefix\": \"10.0.0.0/24\"\r\n },\r\n \"name\": \"sn5292\"\r\n }\r\n ]\r\n },\r\n \"location\": \"SoutheastAsia\"\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "d28299e8-bfaf-41b0-9ed3-b85983d7610f" + "23f82bf3-8ee3-4322-8ae5-b1a492586786" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ], "Content-Type": [ @@ -880,46 +817,46 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:13 GMT" - ], "Pragma": [ "no-cache" ], "Retry-After": [ "3" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "acbe2455-4786-4e7d-b909-e8ca434b8e6a" + "d792042f-eb97-434e-8747-622ac01bcdf9" ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Network/locations/southeastasia/operations/acbe2455-4786-4e7d-b909-e8ca434b8e6a?api-version=2019-09-01" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Network/locations/southeastasia/operations/d792042f-eb97-434e-8747-622ac01bcdf9?api-version=2019-09-01" ], "x-ms-correlation-request-id": [ - "930709ae-1d72-4878-b11a-da2e5807a626" + "dbcf30fd-1726-43bc-8c1f-befa244b39a4" ], "Azure-AsyncNotification": [ "Enabled" ], "x-ms-arm-service-request-id": [ - "5fb05d9e-edbb-4ca9-a760-cd02ffffc5ab" + "b6b14b80-4d04-4554-811f-2273f2062c88" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175213Z:930709ae-1d72-4878-b11a-da2e5807a626" + "WESTUS:20201216T234849Z:dbcf30fd-1726-43bc-8c1f-befa244b39a4" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:49 GMT" + ], "Content-Length": [ "1355" ], @@ -930,19 +867,19 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"vn8196\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196\",\r\n \"etag\": \"W/\\\"4fccb83d-1964-4042-9985-0647d5c436fe\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"southeastasia\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"f5e8e75a-31cc-4f9d-b9b0-f975ff95170a\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": [\r\n \"10.1.1.1\",\r\n \"10.1.2.4\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"sn5318\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\",\r\n \"etag\": \"W/\\\"4fccb83d-1964-4042-9985-0647d5c436fe\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": false\r\n }\r\n}", + "ResponseBody": "{\r\n \"name\": \"vn9317\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317\",\r\n \"etag\": \"W/\\\"2e320d0c-92ad-4b92-8cb2-c2bf771bb4ca\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"southeastasia\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"ebde51e9-49a0-4a00-8926-a33a8c5829f4\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": [\r\n \"10.1.1.1\",\r\n \"10.1.2.4\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"sn5292\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\",\r\n \"etag\": \"W/\\\"2e320d0c-92ad-4b92-8cb2-c2bf771bb4ca\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": false\r\n }\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Network/locations/southeastasia/operations/acbe2455-4786-4e7d-b909-e8ca434b8e6a?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2FjYmUyNDU1LTQ3ODYtNGU3ZC1iOTA5LWU4Y2E0MzRiOGU2YT9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Network/locations/southeastasia/operations/d792042f-eb97-434e-8747-622ac01bcdf9?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2Q3OTIwNDJmLWViOTctNDM0ZS04NzQ3LTYyMmFjMDFiY2RmOT9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -950,42 +887,39 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:16 GMT" - ], "Pragma": [ "no-cache" ], - "Retry-After": [ - "10" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "719bdcfc-89d5-4c88-b212-d65366212f7a" + "69037bdf-317b-4de0-9b30-fc6ba5d1ef04" ], "x-ms-correlation-request-id": [ - "b9d78a52-09a6-4102-9d60-2b8cc799feda" + "278ba80b-58be-45ce-ad60-1349a19b8635" ], "x-ms-arm-service-request-id": [ - "570a0eed-538e-4625-8d64-4564296694f1" + "18f2abee-3aa4-4c0e-b968-d8cf5ebec52b" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175217Z:b9d78a52-09a6-4102-9d60-2b8cc799feda" + "WESTUS:20201216T234853Z:278ba80b-58be-45ce-ad60-1349a19b8635" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:52 GMT" + ], "Content-Length": [ - "30" + "29" ], "Content-Type": [ "application/json; charset=utf-8" @@ -994,19 +928,19 @@ "-1" ] }, - "ResponseBody": "{\r\n \"status\": \"InProgress\"\r\n}", + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Network/locations/southeastasia/operations/acbe2455-4786-4e7d-b909-e8ca434b8e6a?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2FjYmUyNDU1LTQ3ODYtNGU3ZC1iOTA5LWU4Y2E0MzRiOGU2YT9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxOZXR3b3Jrcy92bjkzMTc/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -1014,42 +948,42 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:27 GMT" - ], "Pragma": [ "no-cache" ], - "Retry-After": [ - "10" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "ETag": [ + "W/\"b20b6176-42d8-4b0c-94c4-d5ba51ee3e07\"" ], "x-ms-request-id": [ - "4a46bf83-2e7c-4dc2-9e30-e5c6fa6a0574" + "355a6a2b-558a-4011-ab10-be5b70191abe" ], "x-ms-correlation-request-id": [ - "882f4e59-4100-4689-8e6d-5d69b17dc46d" + "8d5ffa1d-956b-46db-bc6e-80a7466cc288" ], "x-ms-arm-service-request-id": [ - "f4815278-d014-4355-bd16-530385ed8b22" + "a23130b0-babb-4711-9769-cbf02d34b5b9" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175227Z:882f4e59-4100-4689-8e6d-5d69b17dc46d" + "WESTUS:20201216T234853Z:8d5ffa1d-956b-46db-bc6e-80a7466cc288" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:53 GMT" + ], "Content-Length": [ - "30" + "1357" ], "Content-Type": [ "application/json; charset=utf-8" @@ -1058,19 +992,25 @@ "-1" ] }, - "ResponseBody": "{\r\n \"status\": \"InProgress\"\r\n}", + "ResponseBody": "{\r\n \"name\": \"vn9317\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317\",\r\n \"etag\": \"W/\\\"b20b6176-42d8-4b0c-94c4-d5ba51ee3e07\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"southeastasia\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"ebde51e9-49a0-4a00-8926-a33a8c5829f4\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": [\r\n \"10.1.1.1\",\r\n \"10.1.2.4\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"sn5292\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\",\r\n \"etag\": \"W/\\\"b20b6176-42d8-4b0c-94c4-d5ba51ee3e07\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": false\r\n }\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Network/locations/southeastasia/operations/acbe2455-4786-4e7d-b909-e8ca434b8e6a?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2FjYmUyNDU1LTQ3ODYtNGU3ZC1iOTA5LWU4Y2E0MzRiOGU2YT9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxOZXR3b3Jrcy92bjkzMTcvc3VibmV0cy9zbjUyOTI/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "c5d8eed7-ef09-4766-9f74-87f1ba4bc9b5" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -1078,39 +1018,42 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:37 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "ETag": [ + "W/\"b20b6176-42d8-4b0c-94c4-d5ba51ee3e07\"" ], "x-ms-request-id": [ - "d420cac9-f183-487e-b4c4-2f87c663b9c6" + "347939ff-9240-4de5-876f-01d6c3b150e0" ], "x-ms-correlation-request-id": [ - "e88fdf63-ff10-4621-b2db-c80189c71297" + "408a3bac-64e5-477e-944a-6088f001aec8" ], "x-ms-arm-service-request-id": [ - "6287681a-cdb1-46de-acba-9e57cc35daf4" + "50e42110-3f91-487a-a3f9-a0e1e0f13e03" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175237Z:e88fdf63-ff10-4621-b2db-c80189c71297" + "WESTUS:20201216T234854Z:408a3bac-64e5-477e-944a-6088f001aec8" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:53 GMT" + ], "Content-Length": [ - "29" + "523" ], "Content-Type": [ "application/json; charset=utf-8" @@ -1119,211 +1062,77 @@ "-1" ] }, - "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseBody": "{\r\n \"name\": \"sn5292\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\",\r\n \"etag\": \"W/\\\"b20b6176-42d8-4b0c-94c4-d5ba51ee3e07\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxOZXR3b3Jrcy92bjgxOTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", - "RequestMethod": "GET", - "RequestBody": "", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL25ldHdvcmtJbnRlcmZhY2VzL25pYzY2Nj9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"ipConfigurations\": [\r\n {\r\n \"properties\": {\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"properties\": {\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"name\": \"sn5292\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n }\r\n },\r\n \"name\": \"ip7950\"\r\n }\r\n ]\r\n },\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n }\r\n}", "RequestHeaders": { + "x-ms-client-request-id": [ + "b832a590-5360-4a1f-8e67-0ddae208e36e" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "748" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:38 GMT" - ], "Pragma": [ "no-cache" ], - "ETag": [ - "W/\"a554112d-68bf-4da7-8d52-516497dc3891\"" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-request-id": [ - "cd43b31c-f1ee-4532-8690-db8b28caa819" - ], - "x-ms-correlation-request-id": [ - "e771b1a9-d887-4532-a576-33c571296e68" - ], - "x-ms-arm-service-request-id": [ - "02f5409e-1599-4287-869b-ff503abff8c9" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11993" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T175238Z:e771b1a9-d887-4532-a576-33c571296e68" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Length": [ - "1357" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"name\": \"vn8196\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196\",\r\n \"etag\": \"W/\\\"a554112d-68bf-4da7-8d52-516497dc3891\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"southeastasia\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"f5e8e75a-31cc-4f9d-b9b0-f975ff95170a\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\": [\r\n \"10.1.1.1\",\r\n \"10.1.2.4\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"sn5318\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\",\r\n \"etag\": \"W/\\\"a554112d-68bf-4da7-8d52-516497dc3891\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": false\r\n }\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL3ZpcnR1YWxOZXR3b3Jrcy92bjgxOTYvc3VibmV0cy9zbjUzMTg/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", - "RequestMethod": "GET", - "RequestBody": "", - "RequestHeaders": { - "x-ms-client-request-id": [ - "efdcd2d8-d485-4943-b33b-0b27d3216666" - ], - "accept-language": [ - "en-US" - ], - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 17:52:38 GMT" - ], - "Pragma": [ - "no-cache" - ], - "ETag": [ - "W/\"a554112d-68bf-4da7-8d52-516497dc3891\"" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], - "x-ms-request-id": [ - "ef07d1dd-f0eb-421d-aace-9acb0beb4dc2" - ], - "x-ms-correlation-request-id": [ - "6301c899-f6e7-46a1-9ce2-22cc9542f049" - ], - "x-ms-arm-service-request-id": [ - "7f25b50d-95df-464f-842b-405173572147" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11992" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T175238Z:6301c899-f6e7-46a1-9ce2-22cc9542f049" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Length": [ - "523" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"name\": \"sn5318\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\",\r\n \"etag\": \"W/\\\"a554112d-68bf-4da7-8d52-516497dc3891\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL25ldHdvcmtJbnRlcmZhY2VzL25pYzI2NjA/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", - "RequestMethod": "PUT", - "RequestBody": "{\r\n \"properties\": {\r\n \"ipConfigurations\": [\r\n {\r\n \"properties\": {\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"properties\": {\r\n \"addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"name\": \"sn5318\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n }\r\n },\r\n \"name\": \"ip9\"\r\n }\r\n ]\r\n },\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n }\r\n}", - "RequestHeaders": { - "x-ms-client-request-id": [ - "a392f097-50d2-47d7-afc6-501cc0f2e1e9" - ], - "accept-language": [ - "en-US" - ], - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "745" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 17:52:41 GMT" - ], - "Pragma": [ - "no-cache" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], - "x-ms-request-id": [ - "e2561170-28ac-485e-aef8-57b38258c392" + "50bc3c0b-1f27-4d3c-9899-9e4ecb603955" ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Network/locations/southeastasia/operations/e2561170-28ac-485e-aef8-57b38258c392?api-version=2019-09-01" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Network/locations/southeastasia/operations/50bc3c0b-1f27-4d3c-9899-9e4ecb603955?api-version=2019-09-01" ], "x-ms-correlation-request-id": [ - "11df960f-6aed-4ade-985a-afb82768b86b" + "64748d4c-dac1-4328-9e3f-c04fa5657494" ], "Azure-AsyncNotification": [ "Enabled" ], "x-ms-arm-service-request-id": [ - "4e6bead1-35cf-4398-ad52-805fb4bcf0c9" + "fd054643-53eb-4752-bf2c-f759d92417dc" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175241Z:11df960f-6aed-4ade-985a-afb82768b86b" + "WESTUS:20201216T234858Z:64748d4c-dac1-4328-9e3f-c04fa5657494" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:57 GMT" + ], "Content-Length": [ - "1625" + "1628" ], "Content-Type": [ "application/json; charset=utf-8" @@ -1332,19 +1141,19 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"nic2660\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660\",\r\n \"etag\": \"W/\\\"90f79d35-837d-4961-8276-e3a0466d0e98\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"9f7bf15a-21ea-46cf-ba01-bfe42689e286\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ip9\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660/ipConfigurations/ip9\",\r\n \"etag\": \"W/\\\"90f79d35-837d-4961-8276-e3a0466d0e98\\\"\",\r\n \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": \"llt4r3omggou5onq5f055fixbc.ix.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": []\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}", + "ResponseBody": "{\r\n \"name\": \"nic666\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666\",\r\n \"etag\": \"W/\\\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"6bc43b3d-995b-4a22-b182-b5b2748cae69\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ip7950\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666/ipConfigurations/ip7950\",\r\n \"etag\": \"W/\\\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\\\"\",\r\n \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": \"3fi3303ajeaevcjgum3iywbj4e.ix.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": []\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL25ldHdvcmtJbnRlcmZhY2VzL25pYzI2NjA/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL25ldHdvcmtJbnRlcmZhY2VzL25pYzY2Nj9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -1352,42 +1161,42 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:42 GMT" - ], "Pragma": [ "no-cache" ], "ETag": [ - "W/\"90f79d35-837d-4961-8276-e3a0466d0e98\"" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "W/\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\"" ], "x-ms-request-id": [ - "ccdcdbbe-7c67-4710-bc5b-e061b4373447" + "54224365-b0de-4777-8f52-59bda3e5ea42" ], "x-ms-correlation-request-id": [ - "dd9492fa-5346-4101-9fa5-91b7d190f6ba" + "13fcda4c-68f2-456c-ab37-e59ac56d48d9" ], "x-ms-arm-service-request-id": [ - "96711346-1635-43af-a070-9b3dd72e95e7" + "6134cae0-a786-4968-aa83-4364a97709b9" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11991" + "11993" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175242Z:dd9492fa-5346-4101-9fa5-91b7d190f6ba" + "WESTUS:20201216T234859Z:13fcda4c-68f2-456c-ab37-e59ac56d48d9" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:58 GMT" + ], "Content-Length": [ - "1625" + "1628" ], "Content-Type": [ "application/json; charset=utf-8" @@ -1396,25 +1205,25 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"nic2660\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660\",\r\n \"etag\": \"W/\\\"90f79d35-837d-4961-8276-e3a0466d0e98\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"9f7bf15a-21ea-46cf-ba01-bfe42689e286\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ip9\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660/ipConfigurations/ip9\",\r\n \"etag\": \"W/\\\"90f79d35-837d-4961-8276-e3a0466d0e98\\\"\",\r\n \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": \"llt4r3omggou5onq5f055fixbc.ix.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": []\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}", + "ResponseBody": "{\r\n \"name\": \"nic666\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666\",\r\n \"etag\": \"W/\\\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"6bc43b3d-995b-4a22-b182-b5b2748cae69\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ip7950\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666/ipConfigurations/ip7950\",\r\n \"etag\": \"W/\\\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\\\"\",\r\n \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": \"3fi3303ajeaevcjgum3iywbj4e.ix.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": []\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660?api-version=2019-09-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL25ldHdvcmtJbnRlcmZhY2VzL25pYzI2NjA/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5OZXR3b3JrL25ldHdvcmtJbnRlcmZhY2VzL25pYzY2Nj9hcGktdmVyc2lvbj0yMDE5LTA5LTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "68127b46-8d2c-4656-8484-c0a325cd7691" + "1d9a40e3-c555-44b5-b47a-a3159f9fbc2e" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.Network.NetworkManagementClient/19.17.1.0" ] }, @@ -1422,42 +1231,42 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:42 GMT" - ], "Pragma": [ "no-cache" ], "ETag": [ - "W/\"90f79d35-837d-4961-8276-e3a0466d0e98\"" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "W/\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\"" ], "x-ms-request-id": [ - "a7f1ae31-8107-4a00-9032-c0eb8ea73188" + "32e054b1-5e74-4817-8bc9-3f81fbb46b80" ], "x-ms-correlation-request-id": [ - "c328a60d-740e-4f53-bf72-f77964001bf4" + "eb937789-0ad1-45e9-b932-97986781306e" ], "x-ms-arm-service-request-id": [ - "560f727f-1ffc-4608-8a30-a182a2790ecc" + "c4342ac6-9ae9-4eb4-9f21-447b210e444b" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11990" + "11992" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175242Z:c328a60d-740e-4f53-bf72-f77964001bf4" + "WESTUS:20201216T234859Z:eb937789-0ad1-45e9-b932-97986781306e" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:48:58 GMT" + ], "Content-Length": [ - "1625" + "1628" ], "Content-Type": [ "application/json; charset=utf-8" @@ -1466,26 +1275,26 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"nic2660\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660\",\r\n \"etag\": \"W/\\\"90f79d35-837d-4961-8276-e3a0466d0e98\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"9f7bf15a-21ea-46cf-ba01-bfe42689e286\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ip9\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/networkInterfaces/nic2660/ipConfigurations/ip9\",\r\n \"etag\": \"W/\\\"90f79d35-837d-4961-8276-e3a0466d0e98\\\"\",\r\n \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": \"llt4r3omggou5onq5f055fixbc.ix.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": []\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}", + "ResponseBody": "{\r\n \"name\": \"nic666\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666\",\r\n \"etag\": \"W/\\\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\\\"\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"key\": \"value\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"6bc43b3d-995b-4a22-b182-b5b2748cae69\",\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ip7950\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/networkInterfaces/nic666/ipConfigurations/ip7950\",\r\n \"etag\": \"W/\\\"24812dc9-6fa8-478d-bd60-0fa3863bbf29\\\"\",\r\n \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": \"Dynamic\",\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": \"3fi3303ajeaevcjgum3iywbj4e.ix.internal.cloudapp.net\"\r\n },\r\n \"enableAcceleratedNetworking\": false,\r\n \"enableIPForwarding\": false,\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": []\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3MyMDE1P2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3M4MDc4P2FwaS12ZXJzaW9uPTIwMjAtMTItMDE=", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"adminPassword\": \"[PLACEHOLDEr1]\",\r\n \"customData\": \"Q3VzdG9tIGRhdGE=\"\r\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n },\r\n \"osDisk\": {\r\n \"name\": \"test\",\r\n \"caching\": \"None\",\r\n \"createOption\": \"FromImage\",\r\n \"vhdContainers\": [\r\n \"https://crptestar7891.blob.core.windows.net/crptestar8495\"\r\n ]\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig3634\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig7880\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"applicationGatewayBackendAddressPools\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"autoUpgradeMinorVersion\": false,\r\n \"settings\": \"{}\",\r\n \"protectedSettings\": \"{}\"\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"overprovision\": true\r\n },\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n }\r\n}", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"adminPassword\": \"[PLACEHOLDEr1]\",\r\n \"customData\": \"Q3VzdG9tIGRhdGE=\"\r\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n },\r\n \"osDisk\": {\r\n \"name\": \"test\",\r\n \"caching\": \"None\",\r\n \"createOption\": \"FromImage\",\r\n \"vhdContainers\": [\r\n \"https://crptestar2747.blob.core.windows.net/crptestar1250\"\r\n ]\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig9224\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig8567\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"applicationGatewayBackendAddressPools\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"autoUpgradeMinorVersion\": false,\r\n \"settings\": \"{}\",\r\n \"protectedSettings\": \"{}\"\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"overprovision\": true\r\n },\r\n \"location\": \"SoutheastAsia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n }\r\n}", "RequestHeaders": { "x-ms-client-request-id": [ - "0406b731-fedf-4fe4-b2ff-7806dec493ab" + "0990dd75-5a3d-4738-b662-97ff273f43f2" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ], "Content-Type": [ "application/json; charset=utf-8" @@ -1498,27 +1307,20 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:52:51 GMT" - ], "Pragma": [ "no-cache" ], "Retry-After": [ "10" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01" ], "Azure-AsyncNotification": [ "Enabled" ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/CreateVMScaleSet3Min;134,Microsoft.Compute/CreateVMScaleSet30Min;678,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;2713,Microsoft.Compute/VmssQueuedVMOperations;4796" + "Microsoft.Compute/CreateVMScaleSet3Min;59,Microsoft.Compute/CreateVMScaleSet30Min;299,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;1196,Microsoft.Compute/VmssQueuedVMOperations;4796" ], "x-ms-request-charge": [ "4" @@ -1527,22 +1329,29 @@ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "9754bd5c-5fbb-48f6-91f1-fd4408f89c65" + "cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], "x-ms-correlation-request-id": [ - "481c4548-dc1f-43b4-b8d5-da2d78ffe50a" + "9500930c-b247-4707-a5dd-d4af6dd82a13" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175251Z:481c4548-dc1f-43b4-b8d5-da2d78ffe50a" + "WESTCENTRALUS:20201216T234911Z:9500930c-b247-4707-a5dd-d4af6dd82a13" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:49:10 GMT" + ], "Content-Length": [ - "2816" + "3232" ], "Content-Type": [ "application/json; charset=utf-8" @@ -1551,39 +1360,32 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"vmss2015\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar7891.blob.core.windows.net/crptestar8495\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig3634\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig7880\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Creating\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"048230ef-2d07-4c55-9a21-cef34184daea\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"name\": \"vmss8078\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar2747.blob.core.windows.net/crptestar1250\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig9224\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig8567\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Security.AntimalwareSignature\",\r\n \"type\": \"AntimalwareConfiguration\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Creating\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"d5f18b9c-9453-4c9c-bb8c-e137f245c432\"\r\n }\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:53:01 GMT" - ], "Pragma": [ "no-cache" ], "Retry-After": [ "97" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ "Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29999" ], @@ -1591,20 +1393,27 @@ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "c8381a75-e6d8-495f-88d2-a4b1ddfb9f31" + "bb61a165-6063-4e8b-9355-42ad46c6617c" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11997" + "11998" ], "x-ms-correlation-request-id": [ - "5f977415-a849-43a9-b865-883a70bb7cfe" + "2a0af5cb-297a-497f-b707-b1be91abb9a1" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175301Z:5f977415-a849-43a9-b865-883a70bb7cfe" + "WESTCENTRALUS:20201216T234921Z:2a0af5cb-297a-497f-b707-b1be91abb9a1" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:49:20 GMT" + ], "Content-Length": [ "134" ], @@ -1615,36 +1424,29 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:54:37 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ "Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29998" ], @@ -1652,20 +1454,27 @@ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "7c6da6f3-bf2a-418b-97c5-652f26512a95" + "64780642-5de0-42af-98ee-0d93784f2a54" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" + "11997" ], "x-ms-correlation-request-id": [ - "2148cd17-fd5d-4e47-aa04-e4362d1b65c3" + "deaf56dc-c20b-42f0-ac8b-425ea9303bb4" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175438Z:2148cd17-fd5d-4e47-aa04-e4362d1b65c3" + "WESTCENTRALUS:20201216T235059Z:deaf56dc-c20b-42f0-ac8b-425ea9303bb4" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:50:59 GMT" + ], "Content-Length": [ "134" ], @@ -1676,36 +1485,29 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:56:15 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29996" ], @@ -1713,81 +1515,27 @@ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "ad72c6bc-a453-4007-afb8-97465d30131c" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" - ], - "x-ms-correlation-request-id": [ - "93aa6bf8-438f-4a2b-b0d0-6bf15f5f9f7b" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T175615Z:93aa6bf8-438f-4a2b-b0d0-6bf15f5f9f7b" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Length": [ - "134" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", - "RequestMethod": "GET", - "RequestBody": "", - "RequestHeaders": { - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 17:57:52 GMT" - ], - "Pragma": [ - "no-cache" + "d0dc9537-8191-42e0-b0de-f9e93cf7ec07" ], "Server": [ "Microsoft-HTTPAPI/2.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29994" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-request-id": [ - "7305cfdf-e134-4311-9787-d13376b416fa" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" + "11996" ], "x-ms-correlation-request-id": [ - "4aa0b3d4-9a1e-49da-9e55-1e2a6a1ea886" + "a69dda3d-9313-4fd3-8eda-27631aa53c6a" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T175753Z:4aa0b3d4-9a1e-49da-9e55-1e2a6a1ea886" + "WESTCENTRALUS:20201216T235236Z:a69dda3d-9313-4fd3-8eda-27631aa53c6a" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:52:36 GMT" + ], "Content-Length": [ "134" ], @@ -1798,118 +1546,57 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 17:59:30 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29992" + "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29994" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "33990333-4c22-4cbb-a19a-fee34807c22c" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" - ], - "x-ms-correlation-request-id": [ - "d1bc9d39-d2e5-4703-ae8c-737163392302" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T175930Z:d1bc9d39-d2e5-4703-ae8c-737163392302" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Length": [ - "134" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", - "RequestMethod": "GET", - "RequestBody": "", - "RequestHeaders": { - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 18:01:07 GMT" - ], - "Pragma": [ - "no-cache" + "6a749792-e31a-4bb8-bbd0-f754a71fa79d" ], "Server": [ "Microsoft-HTTPAPI/2.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29990" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-request-id": [ - "3c414f05-dbf5-47d6-a9b2-57f42a045e93" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" + "11995" ], "x-ms-correlation-request-id": [ - "158a4bb1-567a-43e2-b641-1a6d92bd6384" + "debec33a-14a2-4756-9f4c-5c1facc26ef2" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T180107Z:158a4bb1-567a-43e2-b641-1a6d92bd6384" + "WESTCENTRALUS:20201216T235413Z:debec33a-14a2-4756-9f4c-5c1facc26ef2" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:54:13 GMT" + ], "Content-Length": [ "134" ], @@ -1920,118 +1607,57 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:02:44 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29989" + "Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29992" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "3aebda0c-21c2-4b06-a207-68cc81dd08ed" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" - ], - "x-ms-correlation-request-id": [ - "cb81a299-f031-41a0-8135-f4379ca557ab" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T180245Z:cb81a299-f031-41a0-8135-f4379ca557ab" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Length": [ - "134" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", - "RequestMethod": "GET", - "RequestBody": "", - "RequestHeaders": { - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 18:04:21 GMT" - ], - "Pragma": [ - "no-cache" + "b1214a64-ea7c-4100-b9d5-cdf0707de539" ], "Server": [ "Microsoft-HTTPAPI/2.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29985" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-request-id": [ - "64b77b95-4484-42e3-8934-f898ce13c02c" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" + "11994" ], "x-ms-correlation-request-id": [ - "84a926dc-3c60-48b6-80a4-dda543b6d7a9" + "7e5a5c47-1b4a-45ba-9715-f663de5e888e" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T180422Z:84a926dc-3c60-48b6-80a4-dda543b6d7a9" + "WESTCENTRALUS:20201216T235551Z:7e5a5c47-1b4a-45ba-9715-f663de5e888e" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:55:50 GMT" + ], "Content-Length": [ "134" ], @@ -2042,118 +1668,57 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:05:59 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14987,Microsoft.Compute/GetOperation30Min;29975" + "Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29990" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "90e99818-446a-4eab-9d6f-197594f5b2e2" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" - ], - "x-ms-correlation-request-id": [ - "36e33b46-d45e-4855-be19-654f29b605da" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T180559Z:36e33b46-d45e-4855-be19-654f29b605da" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Length": [ - "134" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", - "RequestMethod": "GET", - "RequestBody": "", - "RequestHeaders": { - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 18:07:36 GMT" - ], - "Pragma": [ - "no-cache" + "a0b74ca1-340b-460b-9bf6-c84b85e8fe90" ], "Server": [ "Microsoft-HTTPAPI/2.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29966" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-request-id": [ - "74b0af4b-7700-4e36-bd0e-d0f95129c66f" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" + "11993" ], "x-ms-correlation-request-id": [ - "a21457af-b3c7-4b9d-893a-9e81c773e360" + "80c453e7-6a7e-4eee-bee7-40cf1a7a3f66" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T180737Z:a21457af-b3c7-4b9d-893a-9e81c773e360" + "WESTCENTRALUS:20201216T235729Z:80c453e7-6a7e-4eee-bee7-40cf1a7a3f66" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:57:28 GMT" + ], "Content-Length": [ "134" ], @@ -2164,120 +1729,59 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:09:13 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29957" + "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29989" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "fc5db2c9-a2ce-4d17-b66e-51437019147c" - ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" - ], - "x-ms-correlation-request-id": [ - "cd7d6e8b-0362-4139-9f2a-564ebaa98811" - ], - "x-ms-routing-request-id": [ - "WESTUS:20200612T180914Z:cd7d6e8b-0362-4139-9f2a-564ebaa98811" - ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Length": [ - "134" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ] - }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", - "StatusCode": 200 - }, - { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/9754bd5c-5fbb-48f6-91f1-fd4408f89c65?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzk3NTRiZDVjLTVmYmItNDhmNi05MWYxLWZkNDQwOGY4OWM2NT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", - "RequestMethod": "GET", - "RequestBody": "", - "RequestHeaders": { - "User-Agent": [ - "FxVersion/4.6.26614.01", - "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" - ] - }, - "ResponseHeaders": { - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Fri, 12 Jun 2020 18:10:51 GMT" - ], - "Pragma": [ - "no-cache" + "5edc5980-88c2-4ff6-88bd-22c8ca23ac72" ], "Server": [ "Microsoft-HTTPAPI/2.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29948" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-request-id": [ - "efa0777e-0ece-4ead-ad69-8c4811588f11" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" + "11992" ], "x-ms-correlation-request-id": [ - "f9bd5960-a5e3-4b3a-9729-d26ffc02210f" + "55f8d845-46e2-4fd0-9d8e-892a592cc831" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181051Z:f9bd5960-a5e3-4b3a-9729-d26ffc02210f" + "WESTCENTRALUS:20201216T235906Z:55f8d845-46e2-4fd0-9d8e-892a592cc831" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Wed, 16 Dec 2020 23:59:06 GMT" + ], "Content-Length": [ - "184" + "134" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2286,59 +1790,59 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T10:52:48.6183169-07:00\",\r\n \"endTime\": \"2020-06-12T11:10:36.9040084-07:00\",\r\n \"status\": \"Succeeded\",\r\n \"name\": \"9754bd5c-5fbb-48f6-91f1-fd4408f89c65\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3MyMDE1P2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:10:51 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetVMScaleSet3Min;396,Microsoft.Compute/GetVMScaleSet30Min;2594" + "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29987" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "e98f1879-11da-46f2-ba03-89397b90fd92" + "8ad14a2f-8546-4b8e-8e48-cbeb81184e3c" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11998" + "11991" ], "x-ms-correlation-request-id": [ - "674cdb30-7e3c-423f-a5e2-89666fde8a0c" + "06830ab7-d314-4ded-a766-e78de36b6ddd" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181051Z:674cdb30-7e3c-423f-a5e2-89666fde8a0c" + "WESTCENTRALUS:20201217T000043Z:06830ab7-d314-4ded-a766-e78de36b6ddd" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:00:42 GMT" + ], "Content-Length": [ - "2864" + "134" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2347,65 +1851,59 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"vmss2015\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar7891.blob.core.windows.net/crptestar8495\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig3634\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig7880\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"enableAutomaticUpgrade\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"048230ef-2d07-4c55-9a21-cef34184daea\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3MyMDE1P2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { - "x-ms-client-request-id": [ - "040bb86e-a1a8-4958-8bc2-25e318d5ff69" - ], - "accept-language": [ - "en-US" - ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:10:51 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetVMScaleSet3Min;395,Microsoft.Compute/GetVMScaleSet30Min;2593" + "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29985" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "ff0f27b8-2ed2-4b7b-8a66-6e0655d411b3" + "05963a79-ad53-49f2-8b13-6b04a5982f2d" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11997" + "11990" ], "x-ms-correlation-request-id": [ - "bf53ef6a-d900-4712-93b5-9baa80cf5726" + "6b037363-36a2-4bfe-87b1-d41a47509511" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181052Z:bf53ef6a-d900-4712-93b5-9baa80cf5726" + "WESTCENTRALUS:20201217T000220Z:6b037363-36a2-4bfe-87b1-d41a47509511" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:02:20 GMT" + ], "Content-Length": [ - "2864" + "134" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2414,65 +1912,59 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"vmss2015\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar7891.blob.core.windows.net/crptestar8495\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig3634\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig7880\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"enableAutomaticUpgrade\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"048230ef-2d07-4c55-9a21-cef34184daea\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015/instanceView?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3MyMDE1L2luc3RhbmNlVmlldz9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { - "x-ms-client-request-id": [ - "ff16b6b1-f3d6-4530-9aae-7c16901bbc15" - ], - "accept-language": [ - "en-US" - ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:10:51 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/HighCostGetVMScaleSet3Min;178,Microsoft.Compute/HighCostGetVMScaleSet30Min;898" + "Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29983" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "4fa42d1a-35df-4041-8107-5e8e591c08e8" + "94184f46-a4b4-48fc-b0d2-079bd095b551" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11996" + "11989" ], "x-ms-correlation-request-id": [ - "b8c5661a-df85-49ba-a8b4-ee25b5d57338" + "73e63d69-3f5f-4d2f-95f2-09925d57031d" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181052Z:b8c5661a-df85-49ba-a8b4-ee25b5d57338" + "WESTCENTRALUS:20201217T000358Z:73e63d69-3f5f-4d2f-95f2-09925d57031d" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:03:57 GMT" + ], "Content-Length": [ - "15248" + "134" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2481,65 +1973,59 @@ "-1" ] }, - "ResponseBody": "{\r\n \"virtualMachine\": {\r\n \"statusesSummary\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"count\": 2\r\n }\r\n ]\r\n },\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"statusesSummary\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"count\": 2\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"statusesSummary\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"count\": 2\r\n }\r\n ]\r\n }\r\n ],\r\n \"internalData\": {\r\n \"propertyValueSettings\": [\r\n {\r\n \"Key\": \"TestVMHostRebootRepairJobTimeoutInSec\",\r\n \"Value\": \"600\"\r\n },\r\n {\r\n \"Key\": \"PolicyAgentDisabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"VendorRepairCompletionJobSupported\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"VendorRepairInitiationJobSupported\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantManagedHEUpdateEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantManagedHEUpdateFeatureInternallyEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EscalationId\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PublicMRStatusExpirationTimeInUTC\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PublicMRStatusRenewalPeriodInMinutes\",\r\n \"Value\": \"1440\"\r\n },\r\n {\r\n \"Key\": \"PublicMROptinForceDisabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"PublicMRUserEventsEnabled\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantInitiatedRepairThrottlingIntervalInSeconds\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"SupportRollback\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"FailUpdateTenantDuringRollback\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockNextRollingUpgradeTillDateTimeInUtc\",\r\n \"Value\": \"12-30-0001 12:00:00 AM\"\r\n },\r\n {\r\n \"Key\": \"MachinePoolMismatchMigrationStartTimeInUtc\",\r\n \"Value\": \"12-30-0001 12:00:00 AM\"\r\n },\r\n {\r\n \"Key\": \"MREnabledForUpdateNodeToCurrentHE\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsMREnabledForAllRoles\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"RestoreApprovalRequired\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"RestoreNotificationRequired\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantUpdatePrepareApprovalRequired\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantUpdateUnmanagedRollingUpgradePolicyEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantRepairPrepareWaitTimeoutMilliseconds\",\r\n \"Value\": \"9223372036854775807\"\r\n },\r\n {\r\n \"Key\": \"TenantRepairPrepareWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"EvictionPrepareWaitTimeoutMilliseconds\",\r\n \"Value\": \"9223372036854775807\"\r\n },\r\n {\r\n \"Key\": \"EnableDeleteRoleInstanceJob\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantJobIncarnationRequiredForApproval\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithAnyOngoingFDHEUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithImpactfulOngoingFDHEUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ManagedTenantType\",\r\n \"Value\": \"Unprivileged\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureUpdateWaitTimeoutMilliseconds\",\r\n \"Value\": \"900000\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureUpdateWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureRepairWaitTimeoutMilliseconds\",\r\n \"Value\": \"900000\"\r\n },\r\n {\r\n \"Key\": \"ContainerLiveMigrationWaitTimeoutMilliseconds\",\r\n \"Value\": \"600000\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureRepairWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"HealingInfraRepairWaitTimeoutInMilliseconds\",\r\n \"Value\": \"600000\"\r\n },\r\n {\r\n \"Key\": \"HealingInfraRepairWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"HealingInfraRepairAlertOnTimeout\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureRepairAlertOnTimeoutPerTenantType\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureUpdateAlertOnTimeoutPerTenantType\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"OptedOutFromHEUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ActionTakenOnPolicyAgentHealRequest\",\r\n \"Value\": \"RelocateInstance\"\r\n },\r\n {\r\n \"Key\": \"EnableFastServiceHealing\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"EnableLMForCustomerInitiatedMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableSMForCustomerInitiatedMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantOverridableSettingSupportedRepairVerbsRegExpression\",\r\n \"Value\": \".*(Reboot$|Heal$)\"\r\n },\r\n {\r\n \"Key\": \"TenantCreatedBy\",\r\n \"Value\": \"CRP\"\r\n },\r\n {\r\n \"Key\": \"EnableUnrestrictedLowPriority\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"MaxTimeToLiveInMinutesForLowPriority\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"EnableSkipFSHQuorumValidationCheck\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantOwners\",\r\n \"Value\": \"System.Collections.Generic.List`1[RD.Fabric.Controller.ClientType]\"\r\n },\r\n {\r\n \"Key\": \"CrpAuthMetadataUrl\",\r\n \"Value\": \"https://southeastasia.compute.azure.com:10011/AuthenticationMetadata\"\r\n },\r\n {\r\n \"Key\": \"CrpCallbackUrl\",\r\n \"Value\": \"https://southeastasia.compute.azure.com:10010/internal/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/fabricCallback/tenants/62d37c12-f85d-4e6e-bc3e-311b16b5d581\"\r\n },\r\n {\r\n \"Key\": \"CrpLowPriorityPreemptionPolicy\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"PreferRestartDuringInfrastructureUpdates\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantRoleInstanceStartupTimeoutInMilliseconds\",\r\n \"Value\": \"1800000\"\r\n },\r\n {\r\n \"Key\": \"TenantProtectionEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"NodeProtectionEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ContainerProtectionEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"PartialUdWalkEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UdWalkAvailabilityPolicyForTenant\",\r\n \"Value\": \"RequireAllRoleInstancesInCurrentAndPreviousUDsToBeUp\"\r\n },\r\n {\r\n \"Key\": \"MonitorConditionCheckerDisabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableAllocatorSplitTransactionWorkflow\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BootstrapTenantSubscriptionIdValue\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"ProductionFeatureLmGenEnabled\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"AllowLiveMigrationForTenant\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"EnableVMFaultInjectorForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"EnableStopMigrateForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"EnableCustomerInitiatedStopMigrateForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"ProductionFeatureCustomizedLmGenEnabled\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"TimeSchedulerForLiveMigration\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"CustomizedLmGenMaxLMExcecutionCountPerDay\",\r\n \"Value\": \"200\"\r\n },\r\n {\r\n \"Key\": \"CustomizedLmGenMinIntervalBetweenLMTriggerInSeconds\",\r\n \"Value\": \"300\"\r\n },\r\n {\r\n \"Key\": \"CustomerInitiatedStopMigrateSessionCreationRetryCountThreshold\",\r\n \"Value\": \"1\"\r\n },\r\n {\r\n \"Key\": \"StopMigrateSkipDiskCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"CustomerInitiatedStopMigrateSkipDiskCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"StopMigrateEnableResourceDiskPostCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"CustomerInitiatedStopMigrateEnableResourceDiskPostCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"DisableLiveMigrationStartTimeUtc\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"DisableLiveMigrationEndTimeUtc\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"TreatCertificateUpdateAsConfigUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantSuspendedJobWaitTimeoutInMinutes\",\r\n \"Value\": \"15\"\r\n },\r\n {\r\n \"Key\": \"UseDifferentAlertBehaviorForTimeoutAndSignalError\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"JobTimeoutWarningThresholdInMilliseconds\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"JobParallelismEnabled\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"HealingThresholdForMaintenanceInSeconds\",\r\n \"Value\": \"900\"\r\n },\r\n {\r\n \"Key\": \"TopologyChangeDiscovery\",\r\n \"Value\": \"Unknown\"\r\n },\r\n {\r\n \"Key\": \"TopologyBlastEnabledForPortConfigurationChange\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseConnectedRoleInstanceInRCFGeneration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseAllConnectedRoleInstancesAsOutputEndpointTargetInRcf\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AllowDistributedRcfGenerationService\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"RoleConfigGenerationStrategy\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"WaitOnFshDuringTenantUpdateJobs\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsPinnedToCluster\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"RdfeIsPinnedToCluster\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"GuestOSOverrideForTenantUpdate\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"NodeFlightingEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"InPlaceRecoveryBudgetInMinutes\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"AllowNodeDiagnosingOrRecoveryForForServiceHealingAllocationFailure\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"DisableServiceHealing\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AllowNodeDiagnosingOrRecovery\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"LeaseManagerUseRootLeaseForScaleUp\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableTenantLeaseOperationsOnNode\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableLeaseOperationsOnNodeAtTenantLevel\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"OverrideNetworkOperationUsingNsmWithRegionalResource\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseQuorumCheckUdWalkPolicy\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"NodeProtectionSupportForScalingEnabled\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TipNodeSessionId\",\r\n \"Value\": \"00000000-0000-0000-0000-000000000000\"\r\n },\r\n {\r\n \"Key\": \"PFMigrationModeEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateInPFMigrationMode\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantUpdateUdCleanupApprovalRequired\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ApprovalUnavailableActionUpdateJobUntrustedTenant\",\r\n \"Value\": \"Approve\"\r\n },\r\n {\r\n \"Key\": \"UseTargetMachinePoolForAllocation\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsWorkloadTypeHardwareRepairValidation\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SuspendAlertedParallelJobs\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"DisableDedicatedNodeGroupOverride\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ApprovalUnavailableActionAllJobTrustedTenant\",\r\n \"Value\": \"Unknown\"\r\n },\r\n {\r\n \"Key\": \"AllowSeparateUdsDownForRootHEAndUDWalk\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithAnyOngoingOMUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithImpactfulOngoingOMUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SkipEnforcedStabilizationWaitTimeForRebootForMRTenant\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableOptimisticRoleConnectionOnScaleUp\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantEnabledForDNGPublicMRTimeouts\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantEnabledForDedicatedHostPublicMRTimeouts\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AutoUnprotectNodes\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"AllowMRTenantLiveMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseTenantProvidedFaultInfoForVendorRepairBegin\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsAzsmServiceHealingEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsAzPEEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsTenantSpanned\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsTenantSpannable\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AzSMTenantSliceLocation\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PreferredRolesToStartFirst\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PreferredRolesToStopLast\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"OptInForHostUpdatesDuringUDWalk\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableFastAttachDetachForDataDisks\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ForceTenantRdssdToAbcMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"OpportunisticPendingUpdatePublishingEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableBlacklistResourceGroupFeatureForLM\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"AllowTenantInitiatedGuestUpdateWithRepairs\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AllowTenantInitiatedHostUpdateWithRepairs\",\r\n \"Value\": \"False\"\r\n }\r\n ]\r\n },\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n \"time\": \"2020-06-12T11:10:36.8571148-07:00\"\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzP2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { - "x-ms-client-request-id": [ - "136c17fb-47fc-4329-ba4a-4e156ef2fd57" - ], - "accept-language": [ - "en-US" - ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:10:52 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/HighCostGetVMScaleSet3Min;177,Microsoft.Compute/HighCostGetVMScaleSet30Min;897" + "Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29981" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "ce93d893-11e5-4ef7-a2e7-666660f45dfd" + "8d59ae41-8f88-4b93-af3c-f96acc04e3b8" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11995" + "11988" ], "x-ms-correlation-request-id": [ - "6b717f7c-f8a5-4fe1-82df-e8fe9548a55d" + "299bb737-5989-4613-9268-8d5ee0b7f353" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181052Z:6b717f7c-f8a5-4fe1-82df-e8fe9548a55d" + "WESTCENTRALUS:20201217T000535Z:299bb737-5989-4613-9268-8d5ee0b7f353" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:05:35 GMT" + ], "Content-Length": [ - "3209" + "134" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2548,65 +2034,59 @@ "-1" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"name\": \"vmss2015\",\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar7891.blob.core.windows.net/crptestar8495\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig3634\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig7880\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Network/virtualNetworks/vn8196/subnets/sn5318\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"enableAutomaticUpgrade\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"048230ef-2d07-4c55-9a21-cef34184daea\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015/skus?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3MyMDE1L3NrdXM/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { - "x-ms-client-request-id": [ - "bd8164bd-dec7-4580-abc4-63abecfe4320" - ], - "accept-language": [ - "en-US" - ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:10:52 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetVMScaleSet3Min;394,Microsoft.Compute/GetVMScaleSet30Min;2592" + "Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29980" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "43ea2693-73e3-4eec-a536-7d292ae3eb1f" + "4b86441c-23ec-4e55-904b-0cd72dbfd9e0" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11994" + "11987" ], "x-ms-correlation-request-id": [ - "a259bfcf-4ee0-4dbf-accd-47c007cd1e82" + "66b3420a-8f2f-489f-b907-d5921219192f" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181052Z:a259bfcf-4ee0-4dbf-accd-47c007cd1e82" + "WESTCENTRALUS:20201217T000713Z:66b3420a-8f2f-489f-b907-d5921219192f" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:07:13 GMT" + ], "Content-Length": [ - "8728" + "134" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2615,141 +2095,120 @@ "-1" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A3\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A5\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A4\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A6\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A7\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A0\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A1\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A2\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A3\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A4\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D3\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D4\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D11\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D12\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D13\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D14\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A1_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A2m_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A2_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A4m_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A4_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A8m_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A8_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar8659/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2015?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlR3JvdXBzL2NycHRlc3Rhcjg2NTkvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3MyMDE1P2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=", - "RequestMethod": "DELETE", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2NjOGU2YzhlLWU4MjItNGVmOC1iYWQ3LTNhOWVkYTUxNjllYT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", + "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { - "x-ms-client-request-id": [ - "e47ca722-1a1c-4d88-a846-ecc8851beb83" - ], - "accept-language": [ - "en-US" - ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:10:53 GMT" - ], "Pragma": [ "no-cache" ], - "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?monitor=true&api-version=2020-06-01" - ], - "Retry-After": [ - "10" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], - "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01" - ], - "Azure-AsyncNotification": [ - "Enabled" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/DeleteVMScaleSet3Min;79,Microsoft.Compute/DeleteVMScaleSet30Min;399,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;2713,Microsoft.Compute/VmssQueuedVMOperations;4796" - ], - "x-ms-request-charge": [ - "4" + "Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29977" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "da561fa8-a877-4c8a-8dd0-96b089daa711" + "54baddcb-58de-43d4-b60b-e248e2f5e0cb" ], - "x-ms-ratelimit-remaining-subscription-deletes": [ - "14999" + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11986" ], "x-ms-correlation-request-id": [ - "5703bf26-fa48-4665-9e0c-bbe5507684ee" + "befad90f-2e8d-4579-bb0b-3bf408ef2004" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181054Z:5703bf26-fa48-4665-9e0c-bbe5507684ee" + "WESTCENTRALUS:20201217T000850Z:befad90f-2e8d-4579-bb0b-3bf408ef2004" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:08:49 GMT" + ], "Content-Length": [ - "0" + "184" + ], + "Content-Type": [ + "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "ResponseBody": "", - "StatusCode": 202 + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T15:49:07.4465081-08:00\",\r\n \"endTime\": \"2020-12-16T16:08:34.9351367-08:00\",\r\n \"status\": \"Succeeded\",\r\n \"name\": \"cc8e6c8e-e822-4ef8-bad7-3a9eda5169ea\"\r\n}", + "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3M4MDc4P2FwaS12ZXJzaW9uPTIwMjAtMTItMDE=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:11:03 GMT" - ], "Pragma": [ "no-cache" ], - "Retry-After": [ - "11" - ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29947" + "Microsoft.Compute/GetVMScaleSet3Min;396,Microsoft.Compute/GetVMScaleSet30Min;2596" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "6ce7b151-d36a-4c0c-950a-74729bf52eaf" + "f86b22cb-8959-4667-88fa-cd3ddaaa41c1" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11993" + "11985" ], "x-ms-correlation-request-id": [ - "02dce4fa-e46b-4eb3-b20b-bc0508977e5f" + "534b0f86-7baa-41f2-953d-dced6f01cfbf" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181104Z:02dce4fa-e46b-4eb3-b20b-bc0508977e5f" + "WESTCENTRALUS:20201217T000850Z:534b0f86-7baa-41f2-953d-dced6f01cfbf" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:08:49 GMT" + ], "Content-Length": [ - "134" + "3233" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2758,59 +2217,65 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", + "ResponseBody": "{\r\n \"name\": \"vmss8078\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar2747.blob.core.windows.net/crptestar1250\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig9224\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig8567\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Security.AntimalwareSignature\",\r\n \"type\": \"AntimalwareConfiguration\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"d5f18b9c-9453-4c9c-bb8c-e137f245c432\"\r\n }\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3M4MDc4P2FwaS12ZXJzaW9uPTIwMjAtMTItMDE=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "11d54725-4a23-40d0-8f73-50e82d108cef" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:11:14 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29946" + "Microsoft.Compute/GetVMScaleSet3Min;395,Microsoft.Compute/GetVMScaleSet30Min;2595" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "7022106b-46c6-4a41-a84d-672672e7246f" + "072eec9e-7a15-403d-9634-da7b5f3ba82c" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11992" + "11984" ], "x-ms-correlation-request-id": [ - "aa006f5b-f4ca-454a-b16d-9334638adc8c" + "4ce51278-4b5c-4e6f-882a-3c842954f3d6" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181115Z:aa006f5b-f4ca-454a-b16d-9334638adc8c" + "WESTCENTRALUS:20201217T000851Z:4ce51278-4b5c-4e6f-882a-3c842954f3d6" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:08:50 GMT" + ], "Content-Length": [ - "134" + "3233" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2819,59 +2284,65 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", + "ResponseBody": "{\r\n \"name\": \"vmss8078\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar2747.blob.core.windows.net/crptestar1250\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig9224\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig8567\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Security.AntimalwareSignature\",\r\n \"type\": \"AntimalwareConfiguration\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"d5f18b9c-9453-4c9c-bb8c-e137f245c432\"\r\n }\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078/instanceView?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3M4MDc4L2luc3RhbmNlVmlldz9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "302fb5c3-9987-40a6-94dd-3f25cd1690b2" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:11:25 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29945" + "Microsoft.Compute/HighCostGetVMScaleSet3Min;178,Microsoft.Compute/HighCostGetVMScaleSet30Min;898" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "8acfe19b-cce2-468b-bcee-46e996cc3417" + "b4263ea9-c9b1-4306-afa8-cfb7381c3d9f" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11991" + "11983" ], "x-ms-correlation-request-id": [ - "a7bb5316-073a-4eb1-9c75-614819d31b09" + "1a427834-974d-41a4-a80c-ab5ede02a3b9" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181126Z:a7bb5316-073a-4eb1-9c75-614819d31b09" + "WESTCENTRALUS:20201217T000851Z:1a427834-974d-41a4-a80c-ab5ede02a3b9" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:08:50 GMT" + ], "Content-Length": [ - "134" + "16750" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2880,59 +2351,65 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", + "ResponseBody": "{\r\n \"virtualMachine\": {\r\n \"statusesSummary\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"count\": 2\r\n }\r\n ]\r\n },\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"statusesSummary\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"count\": 2\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration\",\r\n \"statusesSummary\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"count\": 2\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"statusesSummary\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"count\": 2\r\n }\r\n ]\r\n }\r\n ],\r\n \"internalData\": {\r\n \"propertyValueSettings\": [\r\n {\r\n \"Key\": \"TestVMHostRebootRepairJobTimeoutInSec\",\r\n \"Value\": \"600\"\r\n },\r\n {\r\n \"Key\": \"PolicyAgentDisabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"VendorRepairCompletionJobSupported\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"VendorRepairInitiationJobSupported\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantManagedHEUpdateEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantManagedHEUpdateFeatureInternallyEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EscalationId\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"VMImpactCoordinationGroupId\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"CoordinationGroupId\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PublicMRStatusExpirationTimeInUTC\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PublicMRStatusRenewalPeriodInMinutes\",\r\n \"Value\": \"1440\"\r\n },\r\n {\r\n \"Key\": \"PublicMROptinForceDisabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"PublicMRUserEventsEnabled\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantInitiatedRepairThrottlingIntervalInSeconds\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"SupportRollback\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"FailUpdateTenantDuringRollback\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockNextRollingUpgradeTillDateTimeInUtc\",\r\n \"Value\": \"12-30-0001 12:00:00 AM\"\r\n },\r\n {\r\n \"Key\": \"MachinePoolMismatchMigrationStartTimeInUtc\",\r\n \"Value\": \"12-30-0001 12:00:00 AM\"\r\n },\r\n {\r\n \"Key\": \"MREnabledForUpdateNodeToCurrentHE\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsMREnabledForAllRoles\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"RestoreApprovalRequired\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"RestoreNotificationRequired\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantUpdatePrepareApprovalRequired\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantUpdateUnmanagedRollingUpgradePolicyEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantRepairPrepareWaitTimeoutMilliseconds\",\r\n \"Value\": \"9223372036854775807\"\r\n },\r\n {\r\n \"Key\": \"TenantRepairPrepareWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"EvictionPrepareWaitTimeoutMilliseconds\",\r\n \"Value\": \"9223372036854775807\"\r\n },\r\n {\r\n \"Key\": \"EnableDeleteRoleInstanceJob\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantJobIncarnationRequiredForApproval\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithAnyOngoingFDHEUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithImpactfulOngoingFDHEUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ManagedTenantType\",\r\n \"Value\": \"Unprivileged\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureUpdateWaitTimeoutMilliseconds\",\r\n \"Value\": \"900000\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureUpdateWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureRepairWaitTimeoutMilliseconds\",\r\n \"Value\": \"900000\"\r\n },\r\n {\r\n \"Key\": \"ContainerLiveMigrationWaitTimeoutMilliseconds\",\r\n \"Value\": \"600000\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureRepairWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"HealingInfraRepairWaitTimeoutInMilliseconds\",\r\n \"Value\": \"600000\"\r\n },\r\n {\r\n \"Key\": \"HealingInfraRepairWaitTimeoutMillisecondsPublicMRFullNode\",\r\n \"Value\": \"7200000\"\r\n },\r\n {\r\n \"Key\": \"HealingInfraRepairAlertOnTimeout\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureRepairAlertOnTimeoutPerTenantType\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"InfrastructureUpdateAlertOnTimeoutPerTenantType\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"OptedOutFromHEUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ActionTakenOnPolicyAgentHealRequest\",\r\n \"Value\": \"RelocateInstance\"\r\n },\r\n {\r\n \"Key\": \"EnableFastServiceHealing\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"EnableFastServiceHealingWithDeadline\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableLMForCustomerInitiatedMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableSMForCustomerInitiatedMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantOverridableSettingSupportedRepairVerbsRegExpression\",\r\n \"Value\": \".*(Reboot$|Heal$)\"\r\n },\r\n {\r\n \"Key\": \"TenantCreatedBy\",\r\n \"Value\": \"CRP\"\r\n },\r\n {\r\n \"Key\": \"EnableUnrestrictedLowPriority\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"MaxTimeToLiveInMinutesForLowPriority\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"EnableSkipFSHQuorumValidationCheck\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantOwners\",\r\n \"Value\": \"System.Collections.Generic.List`1[RD.Fabric.Controller.ClientType]\"\r\n },\r\n {\r\n \"Key\": \"CrpAuthMetadataUrl\",\r\n \"Value\": \"https://southeastasia.compute.azure.com:10011/AuthenticationMetadata\"\r\n },\r\n {\r\n \"Key\": \"CrpCallbackUrl\",\r\n \"Value\": \"https://southeastasia.compute.azure.com:10010/internal/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/fabricCallback/tenants/5f26c242-8fd2-412e-a8e3-84ed251e1619\"\r\n },\r\n {\r\n \"Key\": \"CrpLowPriorityPreemptionPolicy\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"PreferRestartDuringInfrastructureUpdates\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TenantRoleInstanceStartupTimeoutInMilliseconds\",\r\n \"Value\": \"1800000\"\r\n },\r\n {\r\n \"Key\": \"TenantProtectionEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"NodeProtectionEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ContainerProtectionEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"PartialUdWalkEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UdWalkAvailabilityPolicyForTenant\",\r\n \"Value\": \"RequireAllRoleInstancesInCurrentAndPreviousUDsToBeUp\"\r\n },\r\n {\r\n \"Key\": \"MonitorConditionCheckerDisabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableAllocatorSplitTransactionWorkflow\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BootstrapTenantSubscriptionIdValue\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"ProductionFeatureLmGenEnabled\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"AllowLiveMigrationForTenant\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"SkipValidationForCustomerInitiatedStopMigrateforTipSession\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SkipValidationForLMRequestValidatorforTipSession\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SkipValidationForNSMRequestValidatorforTipSession\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SkipValidationForClusterValidatorforTipSession\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SkipValidationForTenantLMReadinessValidatorforTipSession\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SkipValidationForStopMigrateforTipSession\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableVMFaultInjectorForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"EnableStopMigrateForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"EnableCustomerInitiatedStopMigrateForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"ProductionFeatureCustomizedLmGenEnabled\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"TimeSchedulerForLiveMigration\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"CustomizedLmGenMaxLMExcecutionCountPerDay\",\r\n \"Value\": \"200\"\r\n },\r\n {\r\n \"Key\": \"CustomizedLmGenMinIntervalBetweenLMTriggerInSeconds\",\r\n \"Value\": \"300\"\r\n },\r\n {\r\n \"Key\": \"CustomerInitiatedStopMigrateSessionCreationRetryCountThreshold\",\r\n \"Value\": \"1\"\r\n },\r\n {\r\n \"Key\": \"StopMigrateSkipDiskCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"CustomerInitiatedStopMigrateSkipDiskCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"StopMigrateEnableResourceDiskPostCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"CustomerInitiatedStopMigrateEnableResourceDiskPostCopyForTenant\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"DisableLiveMigrationStartTimeUtc\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"DisableLiveMigrationEndTimeUtc\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"TreatCertificateUpdateAsConfigUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantSuspendedJobWaitTimeoutInMinutes\",\r\n \"Value\": \"15\"\r\n },\r\n {\r\n \"Key\": \"UseDifferentAlertBehaviorForTimeoutAndSignalError\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"JobTimeoutWarningThresholdInMilliseconds\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"JobParallelismEnabled\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"HealingThresholdForMaintenanceInSeconds\",\r\n \"Value\": \"900\"\r\n },\r\n {\r\n \"Key\": \"TopologyChangeDiscovery\",\r\n \"Value\": \"Unknown\"\r\n },\r\n {\r\n \"Key\": \"TopologyBlastEnabledForPortConfigurationChange\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseConnectedRoleInstanceInRCFGeneration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseAllConnectedRoleInstancesAsOutputEndpointTargetInRcf\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AllowDistributedRcfGenerationService\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"RoleConfigGenerationStrategy\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"WaitOnFshDuringTenantUpdateJobs\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsPinnedToCluster\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"RdfeIsPinnedToCluster\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"GuestOSOverrideForTenantUpdate\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"NodeFlightingEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"InPlaceRecoveryBudgetInMinutes\",\r\n \"Value\": \"0\"\r\n },\r\n {\r\n \"Key\": \"AllowNodeDiagnosingOrRecoveryForForServiceHealingAllocationFailure\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"DisableServiceHealing\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AllowNodeDiagnosingOrRecovery\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"LeaseManagerUseRootLeaseForScaleUp\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableTenantLeaseOperationsOnNode\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableLeaseOperationsOnNodeAtTenantLevel\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"OverrideNetworkOperationUsingNsmWithRegionalResource\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseQuorumCheckUdWalkPolicy\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"NodeProtectionSupportForScalingEnabled\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"TipNodeSessionId\",\r\n \"Value\": \"00000000-0000-0000-0000-000000000000\"\r\n },\r\n {\r\n \"Key\": \"PFMigrationModeEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateInPFMigrationMode\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantUpdateUdCleanupApprovalRequired\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ApprovalUnavailableActionUpdateJobUntrustedTenant\",\r\n \"Value\": \"Approve\"\r\n },\r\n {\r\n \"Key\": \"UseTargetMachinePoolForAllocation\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsWorkloadTypeHardwareRepairValidation\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SuspendAlertedParallelJobs\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"DisableDedicatedNodeGroupOverride\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ApprovalUnavailableActionAllJobTrustedTenant\",\r\n \"Value\": \"Unknown\"\r\n },\r\n {\r\n \"Key\": \"AllowSeparateUdsDownForRootHEAndUDWalk\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithAnyOngoingOMUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockTenantUpdateWithImpactfulOngoingOMUpdate\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"SkipEnforcedStabilizationWaitTimeForRebootForMRTenant\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableOptimisticRoleConnectionOnScaleUp\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantEnabledForDNGPublicMRTimeouts\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"TenantEnabledForDedicatedHostPublicMRTimeouts\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AutoUnprotectNodes\",\r\n \"Value\": \"True\"\r\n },\r\n {\r\n \"Key\": \"AllowMRTenantLiveMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseTenantProvidedFaultInfoForVendorRepairBegin\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"UseTenantProvidedFaultDetailsForVendorRepairBegin\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsAzsmServiceHealingEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsAzPEEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsTenantSpanned\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"IsTenantSpannable\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AzSMTenantSliceLocation\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PreferredRolesToStartFirst\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"PreferredRolesToStopLast\",\r\n \"Value\": \"\"\r\n },\r\n {\r\n \"Key\": \"OptInForHostUpdatesDuringUDWalk\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableFastAttachDetachForDataDisks\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"ForceTenantRdssdToAbcMigration\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"OpportunisticPendingUpdatePublishingEnabled\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"EnableBlacklistResourceGroupFeatureForLM\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"EnableWhitelistResourceGroupFeatureForLM\",\r\n \"Value\": \"None\"\r\n },\r\n {\r\n \"Key\": \"AllowTenantInitiatedGuestUpdateWithRepairs\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"AllowTenantInitiatedHostUpdateWithRepairs\",\r\n \"Value\": \"False\"\r\n },\r\n {\r\n \"Key\": \"BlockMigrationToAzPEForTenant\",\r\n \"Value\": \"False\"\r\n }\r\n ]\r\n },\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n \"time\": \"2020-12-16T16:08:34.8101181-08:00\"\r\n }\r\n ]\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzP2FwaS12ZXJzaW9uPTIwMjAtMTItMDE=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "0c1ac287-224d-4f0c-8213-a63a2e5c9e63" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:11:36 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14984,Microsoft.Compute/GetOperation30Min;29944" + "Microsoft.Compute/HighCostGetVMScaleSet3Min;177,Microsoft.Compute/HighCostGetVMScaleSet30Min;897" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "03e95ef5-a979-460c-a7e7-346ecbf142ed" + "cc2a23d5-59e5-4a36-8cc2-adbd63075d34" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11990" + "11982" ], "x-ms-correlation-request-id": [ - "25561619-099d-40d0-91cc-786aaf46d988" + "0867b6de-d17b-461b-9ff5-0f13278748e5" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181137Z:25561619-099d-40d0-91cc-786aaf46d988" + "WESTCENTRALUS:20201217T000852Z:0867b6de-d17b-461b-9ff5-0f13278748e5" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:08:51 GMT" + ], "Content-Length": [ - "134" + "3614" ], "Content-Type": [ "application/json; charset=utf-8" @@ -2941,59 +2418,65 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"name\": \"vmss8078\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar2747.blob.core.windows.net/crptestar1250\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig9224\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig8567\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Security.AntimalwareSignature\",\r\n \"type\": \"AntimalwareConfiguration\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"d5f18b9c-9453-4c9c-bb8c-e137f245c432\"\r\n }\r\n }\r\n ]\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/SoutheastAsia/virtualMachineScaleSets?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvU291dGhlYXN0QXNpYS92aXJ0dWFsTWFjaGluZVNjYWxlU2V0cz9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "a496a6dc-ecc3-4561-8437-e460fdf7cae4" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:11:49 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29943" + "Microsoft.Compute/HighCostGetVMScaleSet3Min;176,Microsoft.Compute/HighCostGetVMScaleSet30Min;896" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "e7a8a4b6-96e9-436e-b2ac-043195e1ff7c" + "b51164f4-565a-4bc5-93de-dcaad05c5259" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11989" + "11981" ], "x-ms-correlation-request-id": [ - "e5e5b3ea-b124-44da-b542-28818ebdf317" + "acda11a3-489f-47fc-96e1-078c50016943" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181149Z:e5e5b3ea-b124-44da-b542-28818ebdf317" + "WESTCENTRALUS:20201217T000852Z:acda11a3-489f-47fc-96e1-078c50016943" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:08:51 GMT" + ], "Content-Length": [ - "134" + "3614" ], "Content-Type": [ "application/json; charset=utf-8" @@ -3002,59 +2485,65 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"name\": \"vmss8078\",\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/CRPTESTAR6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078\",\r\n \"type\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"location\": \"southeastasia\",\r\n \"tags\": {\r\n \"RG\": \"rg\",\r\n \"testTag\": \"1\"\r\n },\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n },\r\n \"properties\": {\r\n \"singlePlacementGroup\": true,\r\n \"upgradePolicy\": {\r\n \"mode\": \"Automatic\"\r\n },\r\n \"virtualMachineProfile\": {\r\n \"osProfile\": {\r\n \"computerNamePrefix\": \"test\",\r\n \"adminUsername\": \"Foo12\",\r\n \"windowsConfiguration\": {\r\n \"provisionVMAgent\": true,\r\n \"enableAutomaticUpdates\": true\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n \"vhdContainers\": [\r\n \"https://crptestar2747.blob.core.windows.net/crptestar1250\"\r\n ],\r\n \"name\": \"test\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"None\"\r\n },\r\n \"imageReference\": {\r\n \"publisher\": \"MicrosoftWindowsServer\",\r\n \"offer\": \"WindowsServer\",\r\n \"sku\": \"2012-R2-Datacenter\",\r\n \"version\": \"4.127.20180315\"\r\n }\r\n },\r\n \"networkProfile\": {\r\n \"networkInterfaceConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig9224\",\r\n \"properties\": {\r\n \"primary\": true,\r\n \"enableAcceleratedNetworking\": false,\r\n \"dnsSettings\": {\r\n \"dnsServers\": []\r\n },\r\n \"enableIPForwarding\": false,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"vmsstestnetconfig8567\",\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Network/virtualNetworks/vn9317/subnets/sn5292\"\r\n },\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"extensionProfile\": {\r\n \"extensions\": [\r\n {\r\n \"name\": \"vmssext01\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": false,\r\n \"publisher\": \"Microsoft.Compute\",\r\n \"type\": \"VMAccessAgent\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": \"{}\"\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Security.AntimalwareSignature\",\r\n \"type\": \"AntimalwareConfiguration\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"publisher\": \"Microsoft.Azure.Geneva\",\r\n \"type\": \"GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.0\",\r\n \"settings\": {}\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"overprovision\": true,\r\n \"doNotRunExtensionsOnOverprovisionedVMs\": false,\r\n \"uniqueId\": \"d5f18b9c-9453-4c9c-bb8c-e137f245c432\"\r\n }\r\n }\r\n ]\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078/skus?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3M4MDc4L3NrdXM/YXBpLXZlcnNpb249MjAyMC0xMi0wMQ==", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "cafd9977-8283-48b0-ba1d-e96bced155f2" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:12:00 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14986,Microsoft.Compute/GetOperation30Min;29942" + "Microsoft.Compute/GetVMScaleSet3Min;394,Microsoft.Compute/GetVMScaleSet30Min;2594" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "5007c7e6-c6c9-44c9-936f-7d3a5fde8724" + "03cf6466-27b7-41d8-8f69-5652a8693baf" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11988" + "11980" ], "x-ms-correlation-request-id": [ - "8b8f3527-4e24-48d2-8545-f5a0452bc3f6" + "ed0c04ff-dbc5-4dbc-bc82-36730e154b7d" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181200Z:8b8f3527-4e24-48d2-8545-f5a0452bc3f6" + "WESTCENTRALUS:20201217T000852Z:ed0c04ff-dbc5-4dbc-bc82-36730e154b7d" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:08:51 GMT" + ], "Content-Length": [ - "134" + "13525" ], "Content-Type": [ "application/json; charset=utf-8" @@ -3063,120 +2552,141 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A0\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A3\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A5\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A4\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A6\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A7\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"SQLG3\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A0\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A1\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A2\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A3\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Basic_A4\",\r\n \"tier\": \"Basic\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D3\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D4\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D11\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D12\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D13\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D14\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A1_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A2m_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A2_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A4m_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A4_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A8m_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_A8_v2\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D1_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D2_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D3_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D4_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D5_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D11_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D12_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D13_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Standard_D14_v2_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"ExtraSmall_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Small_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Medium_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"Large_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n },\r\n {\r\n \"resourceType\": \"Microsoft.Compute/virtualMachineScaleSets\",\r\n \"sku\": {\r\n \"name\": \"ExtraLarge_Internal\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"capacity\": {\r\n \"minimum\": 0,\r\n \"maximum\": 40,\r\n \"defaultCapacity\": 1,\r\n \"scaleType\": \"Automatic\"\r\n }\r\n }\r\n ]\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", - "RequestMethod": "GET", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourceGroups/crptestar6252/providers/Microsoft.Compute/virtualMachineScaleSets/vmss8078?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlR3JvdXBzL2NycHRlc3RhcjYyNTIvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lU2NhbGVTZXRzL3Ztc3M4MDc4P2FwaS12ZXJzaW9uPTIwMjAtMTItMDE=", + "RequestMethod": "DELETE", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "a206cf96-4642-47d9-bf16-caadfca0e3bf" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:12:11 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "Location": [ + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/394a596b-e7ef-4132-a793-45c3462d7e71?monitor=true&api-version=2020-12-01" + ], + "Retry-After": [ + "10" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/394a596b-e7ef-4132-a793-45c3462d7e71?api-version=2020-12-01" + ], + "Azure-AsyncNotification": [ + "Enabled" ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14985,Microsoft.Compute/GetOperation30Min;29941" + "Microsoft.Compute/DeleteVMScaleSet3Min;79,Microsoft.Compute/DeleteVMScaleSet30Min;399,Microsoft.Compute/VMScaleSetBatchedVMRequests5Min;1196,Microsoft.Compute/VmssQueuedVMOperations;4796" + ], + "x-ms-request-charge": [ + "4" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "b56ccdc9-3e13-482d-945c-7eccd48bb814" + "394a596b-e7ef-4132-a793-45c3462d7e71" ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11987" + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14998" ], "x-ms-correlation-request-id": [ - "2cfea9c6-d203-4e45-80bc-43d6cb035443" + "bca26799-bbc0-4c9b-a799-b2bd5a3f4d6e" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181211Z:2cfea9c6-d203-4e45-80bc-43d6cb035443" + "WESTCENTRALUS:20201217T000853Z:bca26799-bbc0-4c9b-a799-b2bd5a3f4d6e" ], "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "134" - ], - "Content-Type": [ - "application/json; charset=utf-8" + "Date": [ + "Thu, 17 Dec 2020 00:08:52 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", - "StatusCode": 200 + "ResponseBody": "", + "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/394a596b-e7ef-4132-a793-45c3462d7e71?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzM5NGE1OTZiLWU3ZWYtNDEzMi1hNzkzLTQ1YzM0NjJkN2U3MT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:12:22 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" + "Retry-After": [ + "11" ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14983,Microsoft.Compute/GetOperation30Min;29939" + "Microsoft.Compute/GetOperation3Min;14995,Microsoft.Compute/GetOperation30Min;29976" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "6e451ab5-b623-44cf-a073-89fac658a3c4" + "b0d9b959-aa46-499f-bf07-c083d6d4a1e7" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11986" + "11979" ], "x-ms-correlation-request-id": [ - "9ead59f0-9c56-4e85-98ff-a09c461cac06" + "a0dbe0c3-eb6a-4c59-82f8-92b4b112ed0e" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181222Z:9ead59f0-9c56-4e85-98ff-a09c461cac06" + "WESTCENTRALUS:20201217T000903Z:a0dbe0c3-eb6a-4c59-82f8-92b4b112ed0e" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:09:03 GMT" + ], "Content-Length": [ - "184" + "134" ], "Content-Type": [ "application/json; charset=utf-8" @@ -3185,254 +2695,266 @@ "-1" ] }, - "ResponseBody": "{\r\n \"startTime\": \"2020-06-12T11:10:53.8569643-07:00\",\r\n \"endTime\": \"2020-06-12T11:12:16.3246476-07:00\",\r\n \"status\": \"Succeeded\",\r\n \"name\": \"da561fa8-a877-4c8a-8dd0-96b089daa711\"\r\n}", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T16:08:53.1536524-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"394a596b-e7ef-4132-a793-45c3462d7e71\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/providers/Microsoft.Compute/locations/southeastasia/operations/da561fa8-a877-4c8a-8dd0-96b089daa711?monitor=true&api-version=2020-06-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zL2RhNTYxZmE4LWE4NzctNGM4YS04ZGQwLTk2YjA4OWRhYTcxMT9tb25pdG9yPXRydWUmYXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/394a596b-e7ef-4132-a793-45c3462d7e71?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzM5NGE1OTZiLWU3ZWYtNDEzMi1hNzkzLTQ1YzM0NjJkN2U3MT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.Compute.ComputeManagementClient/37.0.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:12:22 GMT" - ], "Pragma": [ "no-cache" ], - "Server": [ - "Microsoft-HTTPAPI/2.0", - "Microsoft-HTTPAPI/2.0" - ], "x-ms-ratelimit-remaining-resource": [ - "Microsoft.Compute/GetOperation3Min;14982,Microsoft.Compute/GetOperation30Min;29938" + "Microsoft.Compute/GetOperation3Min;14994,Microsoft.Compute/GetOperation30Min;29975" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "66ec2873-3cae-415c-99e9-5203c98086ab" + "9ef6c81f-ee50-48c9-b8ff-ae28bd87904f" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11985" + "11978" ], "x-ms-correlation-request-id": [ - "d0957db0-b796-40fa-ae0c-23c94f6b1d31" + "57a7b0a0-948e-465d-90f3-59319da315e9" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181222Z:d0957db0-b796-40fa-ae0c-23c94f6b1d31" + "WESTCENTRALUS:20201217T000914Z:57a7b0a0-948e-465d-90f3-59319da315e9" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:09:14 GMT" + ], "Content-Length": [ - "0" + "134" + ], + "Content-Type": [ + "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "ResponseBody": "", + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T16:08:53.1536524-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"394a596b-e7ef-4132-a793-45c3462d7e71\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourcegroups/crptestar8659?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL3Jlc291cmNlZ3JvdXBzL2NycHRlc3Rhcjg2NTk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", - "RequestMethod": "DELETE", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/394a596b-e7ef-4132-a793-45c3462d7e71?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzM5NGE1OTZiLWU3ZWYtNDEzMi1hNzkzLTQ1YzM0NjJkN2U3MT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", + "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { - "x-ms-client-request-id": [ - "7bade804-0f83-42ab-a71b-cc6167eaa89f" - ], - "accept-language": [ - "en-US" - ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:12:26 GMT" - ], "Pragma": [ "no-cache" ], - "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" - ], - "Retry-After": [ - "15" + "x-ms-ratelimit-remaining-resource": [ + "Microsoft.Compute/GetOperation3Min;14993,Microsoft.Compute/GetOperation30Min;29974" ], - "x-ms-ratelimit-remaining-subscription-deletes": [ - "14999" + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "290c0612-f537-4a4d-af68-88c5554ff9af" + "d7ee400c-16ef-42ba-ab24-3bd6ee5c97cb" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11977" ], "x-ms-correlation-request-id": [ - "290c0612-f537-4a4d-af68-88c5554ff9af" + "172f6592-f040-4199-8e6a-6c7aa71d6b03" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181226Z:290c0612-f537-4a4d-af68-88c5554ff9af" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" + "WESTCENTRALUS:20201217T000926Z:172f6592-f040-4199-8e6a-6c7aa71d6b03" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:09:25 GMT" + ], "Content-Length": [ - "0" + "134" + ], + "Content-Type": [ + "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "ResponseBody": "", - "StatusCode": 202 + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T16:08:53.1536524-08:00\",\r\n \"status\": \"InProgress\",\r\n \"name\": \"394a596b-e7ef-4132-a793-45c3462d7e71\"\r\n}", + "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/394a596b-e7ef-4132-a793-45c3462d7e71?api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzM5NGE1OTZiLWU3ZWYtNDEzMi1hNzkzLTQ1YzM0NjJkN2U3MT9hcGktdmVyc2lvbj0yMDIwLTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:12:41 GMT" - ], "Pragma": [ "no-cache" ], - "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" - ], - "Retry-After": [ - "15" + "x-ms-ratelimit-remaining-resource": [ + "Microsoft.Compute/GetOperation3Min;14991,Microsoft.Compute/GetOperation30Min;29972" ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11999" + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "95203aab-4fe1-4d86-9722-6a39bd277dff" + "90c2f1b5-55bd-421e-bace-940430d69aaa" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11976" ], "x-ms-correlation-request-id": [ - "95203aab-4fe1-4d86-9722-6a39bd277dff" + "e90ebad1-29d0-4c3d-b739-d9d8955f3c0f" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181241Z:95203aab-4fe1-4d86-9722-6a39bd277dff" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" + "WESTCENTRALUS:20201217T000937Z:e90ebad1-29d0-4c3d-b739-d9d8955f3c0f" ], "X-Content-Type-Options": [ "nosniff" ], + "Date": [ + "Thu, 17 Dec 2020 00:09:36 GMT" + ], "Content-Length": [ - "0" + "184" + ], + "Content-Type": [ + "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "ResponseBody": "", - "StatusCode": 202 + "ResponseBody": "{\r\n \"startTime\": \"2020-12-16T16:08:53.1536524-08:00\",\r\n \"endTime\": \"2020-12-16T16:09:30.4813467-08:00\",\r\n \"status\": \"Succeeded\",\r\n \"name\": \"394a596b-e7ef-4132-a793-45c3462d7e71\"\r\n}", + "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/providers/Microsoft.Compute/locations/southeastasia/operations/394a596b-e7ef-4132-a793-45c3462d7e71?monitor=true&api-version=2020-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9vcGVyYXRpb25zLzM5NGE1OTZiLWU3ZWYtNDEzMi1hNzkzLTQ1YzM0NjJkN2U3MT9tb25pdG9yPXRydWUmYXBpLXZlcnNpb249MjAyMC0xMi0wMQ==", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", - "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/39.0.0.0" ] }, "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:12:56 GMT" - ], "Pragma": [ "no-cache" ], - "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" - ], - "Retry-After": [ - "15" + "x-ms-ratelimit-remaining-resource": [ + "Microsoft.Compute/GetOperation3Min;14990,Microsoft.Compute/GetOperation30Min;29971" ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11998" + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" ], "x-ms-request-id": [ - "54ab97e9-f453-40e4-882c-31de7a81d3bd" + "91291cd0-71b8-4a5b-901a-7456579e9671" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11975" ], "x-ms-correlation-request-id": [ - "54ab97e9-f453-40e4-882c-31de7a81d3bd" + "5c254113-a026-4987-948b-017764e7442c" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181257Z:54ab97e9-f453-40e4-882c-31de7a81d3bd" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" + "WESTCENTRALUS:20201217T000937Z:5c254113-a026-4987-948b-017764e7442c" ], "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:09:36 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", - "StatusCode": 202 + "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", - "RequestMethod": "GET", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/resourcegroups/crptestar6252?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL3Jlc291cmNlZ3JvdXBzL2NycHRlc3RhcjYyNTI/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "DELETE", "RequestBody": "", "RequestHeaders": { + "x-ms-client-request-id": [ + "fdaeae95-b5e1-48bc-9108-12c89dd665c6" + ], + "Accept-Language": [ + "en-US" + ], "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3440,29 +2962,26 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:13:11 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" ], "Retry-After": [ "15" ], - "x-ms-ratelimit-remaining-subscription-reads": [ - "11997" + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" ], "x-ms-request-id": [ - "5a320c19-8edf-4ce2-9d66-132caa173fb8" + "c4dc61d5-83af-4e7b-b8e1-f0c637393fb8" ], "x-ms-correlation-request-id": [ - "5a320c19-8edf-4ce2-9d66-132caa173fb8" + "c4dc61d5-83af-4e7b-b8e1-f0c637393fb8" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181312Z:5a320c19-8edf-4ce2-9d66-132caa173fb8" + "WESTCENTRALUS:20201217T000942Z:c4dc61d5-83af-4e7b-b8e1-f0c637393fb8" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3470,26 +2989,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:09:42 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3497,29 +3019,26 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:13:27 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" ], "Retry-After": [ "15" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11996" + "11999" ], "x-ms-request-id": [ - "267fee69-184e-4c70-b312-fc5274dc670d" + "81b12cf7-5cd5-4d70-8972-f3adf28bf7e5" ], "x-ms-correlation-request-id": [ - "267fee69-184e-4c70-b312-fc5274dc670d" + "81b12cf7-5cd5-4d70-8972-f3adf28bf7e5" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181327Z:267fee69-184e-4c70-b312-fc5274dc670d" + "WESTCENTRALUS:20201217T000958Z:81b12cf7-5cd5-4d70-8972-f3adf28bf7e5" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3527,26 +3046,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:09:57 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3554,29 +3076,26 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:13:43 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" ], "Retry-After": [ "15" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11995" + "11998" ], "x-ms-request-id": [ - "65849e58-f414-4fc7-957e-c4ade7939aca" + "34c40257-3e6e-4ee4-9ec8-58c18b7c6bb2" ], "x-ms-correlation-request-id": [ - "65849e58-f414-4fc7-957e-c4ade7939aca" + "34c40257-3e6e-4ee4-9ec8-58c18b7c6bb2" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181343Z:65849e58-f414-4fc7-957e-c4ade7939aca" + "WESTCENTRALUS:20201217T001013Z:34c40257-3e6e-4ee4-9ec8-58c18b7c6bb2" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3584,26 +3103,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:10:12 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3611,29 +3133,26 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:13:58 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" ], "Retry-After": [ "15" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11994" + "11997" ], "x-ms-request-id": [ - "8907477b-a878-496e-8e64-1604291c23f8" + "fb699f45-ff7e-4d42-8426-1ebc9d8332cf" ], "x-ms-correlation-request-id": [ - "8907477b-a878-496e-8e64-1604291c23f8" + "fb699f45-ff7e-4d42-8426-1ebc9d8332cf" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181358Z:8907477b-a878-496e-8e64-1604291c23f8" + "WESTCENTRALUS:20201217T001029Z:fb699f45-ff7e-4d42-8426-1ebc9d8332cf" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3641,26 +3160,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:10:28 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3668,29 +3190,26 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:14:13 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" ], "Retry-After": [ "15" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11993" + "11996" ], "x-ms-request-id": [ - "6239c24b-53f0-4537-aaca-99b1bf428ca9" + "3c31cd87-967f-4ae3-baff-e5a84fccc912" ], "x-ms-correlation-request-id": [ - "6239c24b-53f0-4537-aaca-99b1bf428ca9" + "3c31cd87-967f-4ae3-baff-e5a84fccc912" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181414Z:6239c24b-53f0-4537-aaca-99b1bf428ca9" + "WESTCENTRALUS:20201217T001044Z:3c31cd87-967f-4ae3-baff-e5a84fccc912" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3698,26 +3217,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:10:44 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3725,29 +3247,26 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:14:28 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" ], "Retry-After": [ "15" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11992" + "11995" ], "x-ms-request-id": [ - "823f5a10-78cc-48f3-8b95-285adc9323a2" + "f139c732-9250-4b1e-b4a7-a0a7842fc212" ], "x-ms-correlation-request-id": [ - "823f5a10-78cc-48f3-8b95-285adc9323a2" + "f139c732-9250-4b1e-b4a7-a0a7842fc212" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181429Z:823f5a10-78cc-48f3-8b95-285adc9323a2" + "WESTCENTRALUS:20201217T001100Z:f139c732-9250-4b1e-b4a7-a0a7842fc212" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3755,26 +3274,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:10:59 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3782,29 +3304,26 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:14:44 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" + "https://management.azure.com/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10" ], "Retry-After": [ "15" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11991" + "11994" ], "x-ms-request-id": [ - "e1e39e9b-b627-4985-ad47-df591760eec0" + "4f501b71-8b2d-4f0a-b215-32eb9c72ae3c" ], "x-ms-correlation-request-id": [ - "e1e39e9b-b627-4985-ad47-df591760eec0" + "4f501b71-8b2d-4f0a-b215-32eb9c72ae3c" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181444Z:e1e39e9b-b627-4985-ad47-df591760eec0" + "WESTCENTRALUS:20201217T001115Z:4f501b71-8b2d-4f0a-b215-32eb9c72ae3c" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3812,26 +3331,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:11:15 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3839,23 +3361,20 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:14:59 GMT" - ], "Pragma": [ "no-cache" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11990" + "11993" ], "x-ms-request-id": [ - "31e9e47a-af7f-4bac-9b15-4857cd6ee00d" + "041430ee-166a-4dc9-bce4-8eefe504049c" ], "x-ms-correlation-request-id": [ - "31e9e47a-af7f-4bac-9b15-4857cd6ee00d" + "041430ee-166a-4dc9-bce4-8eefe504049c" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181500Z:31e9e47a-af7f-4bac-9b15-4857cd6ee00d" + "WESTCENTRALUS:20201217T001130Z:041430ee-166a-4dc9-bce4-8eefe504049c" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3863,26 +3382,29 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:11:30 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI4NjU5LVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjRmYjIzZTMtNmJhMy00MWYwLTliNmUtZTQxMTMxZDVkNjFlL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkk0TmpVNUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", + "RequestUri": "/subscriptions/28337c71-5911-4e75-8354-c4ac645e902d/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DUlBURVNUQVI2MjUyLVNPVVRIRUFTVEFTSUEiLCJqb2JMb2NhdGlvbiI6InNvdXRoZWFzdGFzaWEifQ?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMjgzMzdjNzEtNTkxMS00ZTc1LTgzNTQtYzRhYzY0NWU5MDJkL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFEVWxCVVJWTlVRVkkyTWpVeUxWTlBWVlJJUlVGVFZFRlRTVUVpTENKcWIySk1iMk5oZEdsdmJpSTZJbk52ZFhSb1pXRnpkR0Z6YVdFaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.26614.01", + "FxVersion/4.6.29321.03", "OSName/Windows", - "OSVersion/Microsoft.Windows.10.0.19041.", + "OSVersion/Microsoft.Windows.10.0.19042.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" ] }, @@ -3890,23 +3412,20 @@ "Cache-Control": [ "no-cache" ], - "Date": [ - "Fri, 12 Jun 2020 18:14:59 GMT" - ], "Pragma": [ "no-cache" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "11989" + "11992" ], "x-ms-request-id": [ - "38dbe82b-ec19-4f20-9d33-51df3d843ba6" + "c87b9f5a-17c8-4dd7-947e-c093b875f23b" ], "x-ms-correlation-request-id": [ - "38dbe82b-ec19-4f20-9d33-51df3d843ba6" + "c87b9f5a-17c8-4dd7-947e-c093b875f23b" ], "x-ms-routing-request-id": [ - "WESTUS:20200612T181500Z:38dbe82b-ec19-4f20-9d33-51df3d843ba6" + "WESTCENTRALUS:20201217T001131Z:c87b9f5a-17c8-4dd7-947e-c093b875f23b" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -3914,11 +3433,14 @@ "X-Content-Type-Options": [ "nosniff" ], - "Content-Length": [ - "0" + "Date": [ + "Thu, 17 Dec 2020 00:11:30 GMT" ], "Expires": [ "-1" + ], + "Content-Length": [ + "0" ] }, "ResponseBody": "", @@ -3927,30 +3449,30 @@ ], "Names": { "TestScaleSetOperationsInternal": [ - "crptestar8659", - "vmss2015", - "crptestar7891" + "crptestar6252", + "vmss8078", + "crptestar2747" ], "CreatePublicIP": [ - "pip583", - "dn4901" + "pip9997", + "dn745" ], "CreateVNET": [ - "vn8196", - "sn5318" + "vn9317", + "sn5292" ], "CreateNIC": [ - "nic2660", - "ip9" + "nic666", + "ip7950" ], "CreateDefaultVMScaleSetInput": [ - "crptestar8495", - "vmss6447", - "vmsstestnetconfig3634", - "vmsstestnetconfig7880" + "crptestar1250", + "vmss651", + "vmsstestnetconfig9224", + "vmsstestnetconfig8567" ] }, "Variables": { - "SubscriptionId": "24fb23e3-6ba3-41f0-9b6e-e41131d5d61e" + "SubscriptionId": "28337c71-5911-4e75-8354-c4ac645e902d" } } \ No newline at end of file diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/tests/VMScaleSetTests/VMScaleSetScenarioTests.cs b/sdk/compute/Microsoft.Azure.Management.Compute/tests/VMScaleSetTests/VMScaleSetScenarioTests.cs index 529108ca615bb..65d3bfb1e2fc6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/tests/VMScaleSetTests/VMScaleSetScenarioTests.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/tests/VMScaleSetTests/VMScaleSetScenarioTests.cs @@ -594,6 +594,9 @@ private void TestScaleSetOperationsInternal(MockContext context, string vmSize = var listResponse = m_CrpClient.VirtualMachineScaleSets.List(rgName); ValidateVMScaleSet(inputVMScaleSet, listResponse.FirstOrDefault(x => x.Name == vmssName), hasManagedDisks); + var listByLocationResponse = m_CrpClient.VirtualMachineScaleSets.ListByLocation(ComputeManagementTestUtilities.DefaultLocation); + ValidateVMScaleSet(inputVMScaleSet, listByLocationResponse.FirstOrDefault(x => x.Name == vmssName), hasManagedDisks); + if (validateListSku) { var listSkusResponse = m_CrpClient.VirtualMachineScaleSets.ListSkus(rgName, vmssName);