From 4e176a3119f0f5d31869254da86a1e06b52969b8 Mon Sep 17 00:00:00 2001 From: Ryan Truong Date: Tue, 8 Jun 2021 14:00:24 -0700 Subject: [PATCH 1/2] Update .NET SDK to add BeginGetAccess for DiskRestorePoint --- .../Generated/DiskRestorePointOperations.cs | 500 ++++++++++++++++++ .../DiskRestorePointOperationsExtensions.cs | 254 +++++++++ .../Generated/IDiskRestorePointOperations.cs | 150 ++++++ .../SdkInfo_ComputeManagementClient.cs | 11 + 4 files changed, 915 insertions(+) diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperations.cs index b3816a506daf..1829bd2a0b85 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperations.cs @@ -474,6 +474,506 @@ internal DiskRestorePointOperations(ComputeManagementClient client) return _result; } + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (vmRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmRestorePointName"); + } + if (diskRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskRestorePointName"); + } + if (grantAccessData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "grantAccessData"); + } + if (grantAccessData != null) + { + grantAccessData.Validate(); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("vmRestorePointName", vmRestorePointName); + tracingParameters.Add("diskRestorePointName", diskRestorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("grantAccessData", grantAccessData); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGrantAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{vmRestorePointName}", System.Uri.EscapeDataString(vmRestorePointName)); + _url = _url.Replace("{diskRestorePointName}", System.Uri.EscapeDataString(diskRestorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(grantAccessData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(grantAccessData, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, 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 (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (vmRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmRestorePointName"); + } + if (diskRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskRestorePointName"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("vmRestorePointName", vmRestorePointName); + tracingParameters.Add("diskRestorePointName", diskRestorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevokeAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{vmRestorePointName}", System.Uri.EscapeDataString(vmRestorePointName)); + _url = _url.Replace("{diskRestorePointName}", System.Uri.EscapeDataString(diskRestorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists diskRestorePoints under a vmRestorePoint. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperationsExtensions.cs index 1ce2e70ac2c2..6ea1d754cdab 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskRestorePointOperationsExtensions.cs @@ -137,6 +137,260 @@ public static IPage ListByRestorePoint(this IDiskRestorePointO } } + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri GrantAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData) + { + return operations.GrantAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task GrantAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GrantAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + public static void RevokeAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName) + { + operations.RevokeAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task RevokeAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RevokeAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri BeginGrantAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData) + { + return operations.BeginGrantAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginGrantAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + public static void BeginRevokeAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName) + { + operations.BeginRevokeAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name + /// length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters for the + /// name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevokeAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Lists diskRestorePoints under a vmRestorePoint. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskRestorePointOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskRestorePointOperations.cs index c385b750b237..ca3b34a2a6f7 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskRestorePointOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskRestorePointOperations.cs @@ -93,6 +93,156 @@ public partial interface IDiskRestorePointOperations /// Task>> ListByRestorePointWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. Supported characters for the name are a-z, A-Z, 0-9 + /// and _. The maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. + /// The maximum name length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. Supported characters for the name are a-z, A-Z, 0-9 + /// and _. The maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. + /// The maximum name length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. Supported characters for the name are a-z, A-Z, 0-9 + /// and _. The maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. + /// The maximum name length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. Supported characters for the name are a-z, A-Z, 0-9 + /// and _. The maximum name length is 80 characters. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. + /// The maximum name length is 80 characters. + /// + /// + /// The name of the disk restore point created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists diskRestorePoints under a vmRestorePoint. /// /// 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 f5e2bf57aecd..cf51d4e17c85 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 @@ -66,5 +66,16 @@ 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=C:\\work\\azure-sdk-for-net\\sdk"; + public static readonly String GithubForkName = "Azure"; + public static readonly String GithubBranchName = "master"; + public static readonly String GithubCommidId = "e134a5f2e59827fc73b21c12e397dead18548877"; + public static readonly String CodeGenerationErrors = ""; + public static readonly String GithubRepoName = "azure-rest-api-specs"; + // END: Code Generation Metadata Section } } + From 77a056ffcc658b05ebc4688480bda734b894542a Mon Sep 17 00:00:00 2001 From: Ryan Truong Date: Tue, 8 Jun 2021 16:26:01 -0700 Subject: [PATCH 2/2] added missing file --- eng/mgmt/mgmtmetadata/compute_resource-manager.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/mgmt/mgmtmetadata/compute_resource-manager.txt b/eng/mgmt/mgmtmetadata/compute_resource-manager.txt index 35a6c9020c9e..9c016341e016 100644 --- a/eng/mgmt/mgmtmetadata/compute_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/compute_resource-manager.txt @@ -4,11 +4,12 @@ Commencing code generation Generating CSharp code Executing AutoRest command cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\azure-sdk-for-net\sdk -2021-05-25 08:04:43 UTC +Autorest CSharp Version: 2.3.82 +2021-06-08 20:55:17 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: aa62339078c075d81aa1019c62450805f750e2d7 +Commit: e134a5f2e59827fc73b21c12e397dead18548877 AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413