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 b7b7989a1252..de53f6a7b193 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs @@ -191,6 +191,11 @@ public partial class ComputeManagementClient : ServiceClient public virtual IDiskEncryptionSetsOperations DiskEncryptionSets { get; private set; } + /// + /// Gets the IDiskAccessesOperations. + /// + public virtual IDiskAccessesOperations DiskAccesses { get; private set; } + /// /// Gets the IGalleriesOperations. /// @@ -486,6 +491,7 @@ private void Initialize() 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); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperations.cs new file mode 100644 index 000000000000..df828c077b8a --- /dev/null +++ b/sdk/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-05-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("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-05-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/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-05-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/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-05-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("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-05-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("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-05-01"; + 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-05-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("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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskAccessesOperationsExtensions.cs new file mode 100644 index 000000000000..ac8a49af2ba7 --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs index fd2ba13de313..dbeb3d0e55c9 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs @@ -155,7 +155,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,7 +367,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -545,7 +545,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -750,7 +750,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) { diskEncryptionSet.Validate(); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -840,7 +840,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -901,7 +901,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) } } // Deserialize Response - if ((int)_statusCode == 201) + if ((int)_statusCode == 202) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try @@ -980,7 +980,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSet"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1199,7 +1199,7 @@ internal DiskEncryptionSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs index 8e79b5cddc95..47ef6c3a8970 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs @@ -150,7 +150,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +361,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -539,7 +539,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -793,7 +793,7 @@ internal DisksOperations(ComputeManagementClient client) { disk.Validate(); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1021,7 +1021,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "disk"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1239,7 +1239,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1428,7 +1428,7 @@ internal DisksOperations(ComputeManagementClient client) { grantAccessData.Validate(); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1628,7 +1628,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 bfe2b2eed074..12145c0f68bc 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs @@ -186,6 +186,11 @@ public partial interface IComputeManagementClient : System.IDisposable /// IDiskEncryptionSetsOperations DiskEncryptionSets { get; } + /// + /// Gets the IDiskAccessesOperations. + /// + IDiskAccessesOperations DiskAccesses { get; } + /// /// Gets the IGalleriesOperations. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskAccessesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskAccessesOperations.cs new file mode 100644 index 000000000000..2a3a06016e2f --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs index 8e8dc2c27dc4..42e004b6c55e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs @@ -97,7 +97,11 @@ public Disk() /// 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. - 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)) + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on 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)) : base(location, id, name, type, tags) { ManagedBy = managedBy; @@ -121,6 +125,8 @@ public Disk() Encryption = encryption; MaxShares = maxShares; ShareInfo = shareInfo; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; CustomInit(); } @@ -282,6 +288,20 @@ public Disk() [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; } + /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccess.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccess.cs new file mode 100644 index 000000000000..f16592d89dba --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccessUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskAccessUpdate.cs new file mode 100644 index 000000000000..eb626405e5bb --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs index 4403d34ecea2..6afd9340ca56 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs @@ -39,6 +39,10 @@ public DiskEncryptionSet() /// Resource name /// Resource type /// Resource tags + /// Possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' /// The key vault key which is currently used /// by this disk encryption set. /// A readonly collection of key vault keys @@ -47,10 +51,11 @@ public DiskEncryptionSet() /// 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), KeyVaultAndKeyReference activeKey = default(KeyVaultAndKeyReference), IList previousKeys = default(IList), string provisioningState = default(string)) + 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; @@ -67,6 +72,15 @@ public DiskEncryptionSet() [JsonProperty(PropertyName = "identity")] public EncryptionSetIdentity Identity { get; set; } + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// '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. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskUpdate.cs index 8bb3d66f5283..a3a9f1f243b4 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskUpdate.cs @@ -65,8 +65,12 @@ public DiskUpdate() /// 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 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), IDictionary tags = default(IDictionary), DiskSku sku = default(DiskSku)) + 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), IDictionary tags = default(IDictionary), DiskSku sku = default(DiskSku)) { OsType = osType; DiskSizeGB = diskSizeGB; @@ -77,6 +81,8 @@ public DiskUpdate() DiskMBpsReadOnly = diskMBpsReadOnly; MaxShares = maxShares; Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; Tags = tags; Sku = sku; CustomInit(); @@ -160,6 +166,20 @@ public DiskUpdate() [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 /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs index a5af4e2fb2c6..345dec01e4c3 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs @@ -31,9 +31,10 @@ public Encryption() /// /// ResourceId of the disk encryption /// set to use for enabling encryption at rest. - /// The type of key used to encrypt the data of the - /// disk. Possible values include: 'EncryptionAtRestWithPlatformKey', - /// 'EncryptionAtRestWithCustomerKey' + /// Possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' public Encryption(string diskEncryptionSetId = default(string), string type = default(string)) { DiskEncryptionSetId = diskEncryptionSetId; @@ -54,9 +55,10 @@ public Encryption() public string DiskEncryptionSetId { get; set; } /// - /// Gets or sets the type of key used to encrypt the data of the disk. - /// Possible values include: 'EncryptionAtRestWithPlatformKey', - /// 'EncryptionAtRestWithCustomerKey' + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs index d2173440de7f..a0ed0c8f821e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs @@ -17,13 +17,19 @@ namespace Microsoft.Azure.Management.Compute.Models public static class EncryptionType { /// - /// Disk is encrypted with XStore managed key at rest. It is the + /// Disk is encrypted at rest with Platform managed key. It is the /// default encryption type. /// public const string EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey"; /// - /// Disk is encrypted with Customer managed key at rest. + /// 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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkAccessPolicy.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/NetworkAccessPolicy.cs new file mode 100644 index 000000000000..889fa06a09e9 --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpoint.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..ef7080558242 --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..0937c63d601b --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..a5faa7278f6f --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..7563361c9555 --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResource.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..5c8516507969 --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResourceListResult.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..74345e724609 --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..fd42da8e3751 --- /dev/null +++ b/sdk/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/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs index e67155404d15..938b2e6bdf6e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs @@ -43,7 +43,7 @@ public Snapshot() /// Resource type /// Resource tags /// Unused. Always Null. - /// The time when the disk was + /// The time when the snapshot was /// created. /// The Operating System type. Possible values /// include: 'Windows', 'Linux' @@ -71,7 +71,11 @@ public Snapshot() /// Encryption property can be used to encrypt /// data at rest with customer managed keys or platform managed /// keys. - 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 uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool? incremental = default(bool?), Encryption encryption = default(Encryption)) + /// 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 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; @@ -87,6 +91,8 @@ public Snapshot() ProvisioningState = provisioningState; Incremental = incremental; Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; CustomInit(); } @@ -107,7 +113,7 @@ public Snapshot() public SnapshotSku Sku { get; set; } /// - /// Gets the time when the disk was created. + /// Gets the time when the snapshot was created. /// [JsonProperty(PropertyName = "properties.timeCreated")] public System.DateTime? TimeCreated { get; private set; } @@ -184,6 +190,20 @@ public Snapshot() [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. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotUpdate.cs index 2aceff746aaa..300c671b7b59 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/SnapshotUpdate.cs @@ -48,13 +48,19 @@ public SnapshotUpdate() /// 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), IDictionary tags = default(IDictionary), SnapshotSku sku = default(SnapshotSku)) + 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(); @@ -97,6 +103,20 @@ public SnapshotUpdate() [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 /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs index 7190b0fd0b54..261206a71597 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs @@ -60,13 +60,13 @@ public VirtualMachineScaleSetIPConfiguration() /// 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 load - /// balancer. + /// 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 load - /// balancer + /// 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) { @@ -141,7 +141,7 @@ public VirtualMachineScaleSetIPConfiguration() /// 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 load balancer. + /// sets cannot use the same basic sku load balancer. /// [JsonProperty(PropertyName = "properties.loadBalancerBackendAddressPools")] public IList LoadBalancerBackendAddressPools { get; set; } @@ -150,7 +150,7 @@ public VirtualMachineScaleSetIPConfiguration() /// 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 load balancer + /// cannot use the same basic sku load balancer. /// [JsonProperty(PropertyName = "properties.loadBalancerInboundNatPools")] public IList LoadBalancerInboundNatPools { get; set; } 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 f0aba24db88c..d099e82f046c 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 @@ -22,8 +22,9 @@ public static IEnumerable> ApiInfo_ComputeManageme new Tuple("Compute", "AvailabilitySets", "2019-12-01"), new Tuple("Compute", "DedicatedHostGroups", "2019-12-01"), new Tuple("Compute", "DedicatedHosts", "2019-12-01"), - new Tuple("Compute", "DiskEncryptionSets", "2019-11-01"), - new Tuple("Compute", "Disks", "2019-11-01"), + new Tuple("Compute", "DiskAccesses", "2020-05-01"), + new Tuple("Compute", "DiskEncryptionSets", "2020-05-01"), + new Tuple("Compute", "Disks", "2020-05-01"), new Tuple("Compute", "Galleries", "2019-12-01"), new Tuple("Compute", "GalleryApplicationVersions", "2019-12-01"), new Tuple("Compute", "GalleryApplications", "2019-12-01"), @@ -34,7 +35,7 @@ public static IEnumerable> ApiInfo_ComputeManageme new Tuple("Compute", "Operations", "2019-12-01"), new Tuple("Compute", "ProximityPlacementGroups", "2019-12-01"), new Tuple("Compute", "ResourceSkus", "2019-04-01"), - new Tuple("Compute", "Snapshots", "2019-11-01"), + new Tuple("Compute", "Snapshots", "2020-05-01"), new Tuple("Compute", "SshPublicKeys", "2019-12-01"), new Tuple("Compute", "Usage", "2019-12-01"), new Tuple("Compute", "VirtualMachineExtensionImages", "2019-12-01"), @@ -52,16 +53,5 @@ public static IEnumerable> ApiInfo_ComputeManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=D:\\hylee-sdk\\may\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "eb91865bf3284a739f1f0ded036f0e37bbcebe8d"; - 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/SnapshotsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs index c6d14c219ef8..1b224c910e70 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs @@ -150,7 +150,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +361,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -539,7 +539,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -794,7 +794,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { snapshot.Validate(); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1022,7 +1022,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshot"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1240,7 +1240,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1430,7 +1430,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { grantAccessData.Validate(); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1630,7 +1630,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); } - string apiVersion = "2019-11-01"; + string apiVersion = "2020-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null;