From 4a5228748e048c3fb98a2b91a9c3473c2590fa51 Mon Sep 17 00:00:00 2001 From: haagha <64601174+haagha@users.noreply.github.com> Date: Thu, 21 Apr 2022 01:51:04 -0400 Subject: [PATCH] [Compute] CDRP SDK https://github.com/Azure/azure-rest-api-specs/pull/18351 (#27726) * Initial commit. * update version * adding preview * assembly version change * fix compute_resource-manager * fix resource_manager * assembly changes * tags and assembly version * version update --- .../mgmtmetadata/compute_resource-manager.txt | 6 +- .../AzSdk.RP.props | 2 +- .../src/Generated/ComputeManagementClient.cs | 24 + .../src/Generated/DiagnosticOperations.cs | 224 +++++++++ .../DiagnosticOperationsExtensions.cs | 64 +++ .../src/Generated/DiagnosticsOperations.cs | 403 +++++++++++++++ .../DiagnosticsOperationsExtensions.cs | 93 ++++ .../src/Generated/DiskInspectionOperations.cs | 464 ++++++++++++++++++ .../DiskInspectionOperationsExtensions.cs | 143 ++++++ ...nspectionStorageConfigurationOperations.cs | 427 ++++++++++++++++ ...torageConfigurationOperationsExtensions.cs | 98 ++++ .../src/Generated/IComputeManagementClient.cs | 20 + .../src/Generated/IDiagnosticOperations.cs | 50 ++ .../src/Generated/IDiagnosticsOperations.cs | 73 +++ .../Generated/IDiskInspectionOperations.cs | 102 ++++ ...nspectionStorageConfigurationOperations.cs | 73 +++ .../Generated/Models/ComputeDiagnosticBase.cs | 73 +++ .../Generated/Models/DiagnosticProperties.cs | 55 +++ .../src/Generated/Models/ErrorDetail.cs | 85 ++++ .../src/Generated/Models/ErrorResponse.cs | 50 ++ .../Models/ErrorResponseException.cs | 62 +++ .../src/Generated/Models/ResultStatus.cs | 22 + .../RunDiskInspectionAsyncOperationResult.cs | 75 +++ .../Models/RunDiskInspectionInput.cs | 91 ++++ .../Models/StorageConfigurationInput.cs | 66 +++ .../Models/StorageConfigurationResponse.cs | 52 ++ .../SdkInfo_ComputeManagementClient.cs | 4 + .../Microsoft.Azure.Management.Compute.csproj | 6 +- .../src/Properties/AssemblyInfo.cs | 2 +- 29 files changed, 2901 insertions(+), 8 deletions(-) create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperationsExtensions.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticsOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticsOperationsExtensions.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionOperationsExtensions.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionStorageConfigurationOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionStorageConfigurationOperationsExtensions.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticsOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionStorageConfigurationOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComputeDiagnosticBase.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiagnosticProperties.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResultStatus.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionAsyncOperationResult.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionInput.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationInput.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationResponse.cs diff --git a/eng/mgmt/mgmtmetadata/compute_resource-manager.txt b/eng/mgmt/mgmtmetadata/compute_resource-manager.txt index cfbeca91bc0f..a3081886f360 100644 --- a/eng/mgmt/mgmtmetadata/compute_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/compute_resource-manager.txt @@ -3,13 +3,13 @@ AutoRest installed successfully. 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:\work\azure-sdk-for-net\sdk +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/compute/resource-manager/readme.md --tag=package-2021-06-01-preview --csharp --version=2.0.4421 --reflect-api-versions --csharp-sdks-folder=C:\work\azure-sdk-for-net\sdk Autorest CSharp Version: 2.3.82 2021-10-20 19:24:00 UTC Azure-rest-api-specs repository information GitHub fork: Azure -Branch: master -Commit: 6cae16d785c0916d73085fac1587e061308626b6 +Branch: main +Commit: dbf0a617330c7ea3794df1596ba4c1484058fa66 AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/AzSdk.RP.props b/sdk/compute/Microsoft.Azure.Management.Compute/AzSdk.RP.props index 05bafc894364..61af1b2f88e8 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/AzSdk.RP.props +++ b/sdk/compute/Microsoft.Azure.Management.Compute/AzSdk.RP.props @@ -1,7 +1,7 @@  - Compute_2021-11-01;Compute_2021-03-01;Compute_2021-07-01;Compute_2021-12-01;Compute_2021-10-01; + Compute_2021-11-01;Compute_2021-03-01;Compute_2021-07-01;Compute_2021-12-01;Compute_2021-10-01;Compute_2021-06-01-preview $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file 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 4fe5ed4724a9..606595f2a522 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs @@ -316,6 +316,26 @@ public partial class ComputeManagementClient : ServiceClient public virtual ICloudServiceOperatingSystemsOperations CloudServiceOperatingSystems { get; private set; } + /// + /// Gets the IDiagnosticOperations. + /// + public virtual IDiagnosticOperations DiagnosticOperations { get; private set; } + + /// + /// Gets the IDiskInspectionOperations. + /// + public virtual IDiskInspectionOperations DiskInspection { get; private set; } + + /// + /// Gets the IDiagnosticsOperations. + /// + public virtual IDiagnosticsOperations Diagnostics { get; private set; } + + /// + /// Gets the IDiskInspectionStorageConfigurationOperations. + /// + public virtual IDiskInspectionStorageConfigurationOperations DiskInspectionStorageConfiguration { get; private set; } + /// /// Initializes a new instance of the ComputeManagementClient class. /// @@ -606,6 +626,10 @@ private void Initialize() CloudServices = new CloudServicesOperations(this); CloudServicesUpdateDomain = new CloudServicesUpdateDomainOperations(this); CloudServiceOperatingSystems = new CloudServiceOperatingSystemsOperations(this); + DiagnosticOperations = new DiagnosticOperations(this); + DiskInspection = new DiskInspectionOperations(this); + Diagnostics = new DiagnosticsOperations(this); + DiskInspectionStorageConfiguration = new DiskInspectionStorageConfigurationOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperations.cs new file mode 100644 index 000000000000..1a11832a4167 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperations.cs @@ -0,0 +1,224 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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; + + /// + /// DiagnosticOperations operations. + /// + internal partial class DiagnosticOperations : IServiceOperations, IDiagnosticOperations + { + /// + /// Initializes a new instance of the DiagnosticOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiagnosticOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets status of a Diagnostic operation issued for Disk Inspection. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The identifier pointing to a request for Disk Inspection. This is used for + /// polling result of the request. + /// + /// + /// 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 ReadWithHttpMessagesAsync(string location, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Read", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnosticOperations/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperationsExtensions.cs new file mode 100644 index 000000000000..90aae3ed1fba --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticOperationsExtensions.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiagnosticOperations. + /// + public static partial class DiagnosticOperationsExtensions + { + /// + /// Gets status of a Diagnostic operation issued for Disk Inspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The identifier pointing to a request for Disk Inspection. This is used for + /// polling result of the request. + /// + public static void Read(this IDiagnosticOperations operations, string location, string operationId) + { + operations.ReadAsync(location, operationId).GetAwaiter().GetResult(); + } + + /// + /// Gets status of a Diagnostic operation issued for Disk Inspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The identifier pointing to a request for Disk Inspection. This is used for + /// polling result of the request. + /// + /// + /// The cancellation token. + /// + public static async Task ReadAsync(this IDiagnosticOperations operations, string location, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReadWithHttpMessagesAsync(location, operationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticsOperations.cs new file mode 100644 index 000000000000..e4a675782cda --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticsOperations.cs @@ -0,0 +1,403 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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; + + /// + /// DiagnosticsOperations operations. + /// + internal partial class DiagnosticsOperations : IServiceOperations, IDiagnosticsOperations + { + /// + /// Initializes a new instance of the DiagnosticsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiagnosticsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Lists all available Compute diagnostics for a subscription in a location. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnostics").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all available Compute diagnostics for a subscription in a location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _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/DiagnosticsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticsOperationsExtensions.cs new file mode 100644 index 000000000000..8e3d34b58435 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiagnosticsOperationsExtensions.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiagnosticsOperations. + /// + public static partial class DiagnosticsOperationsExtensions + { + /// + /// Lists all available Compute diagnostics for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + public static IPage List(this IDiagnosticsOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Lists all available Compute diagnostics for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDiagnosticsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all available Compute diagnostics for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDiagnosticsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all available Compute diagnostics for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDiagnosticsOperations 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/DiskInspectionOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionOperations.cs new file mode 100644 index 000000000000..51b92ee3fcc4 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionOperations.cs @@ -0,0 +1,464 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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; + + /// + /// DiskInspectionOperations operations. + /// + internal partial class DiskInspectionOperations : IServiceOperations, IDiskInspectionOperations + { + /// + /// Initializes a new instance of the DiskInspectionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskInspectionOperations(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 a request for executing disk Inspection. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string location, RunDiskInspectionInput runDiskInspectionInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(location, runDiskInspectionInput, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a specific Compute diagnostic for a subscription in a location. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnostics/diskInspection").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a request for executing disk Inspection. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection 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> BeginCreateWithHttpMessagesAsync(string location, RunDiskInspectionInput runDiskInspectionInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (runDiskInspectionInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runDiskInspectionInput"); + } + if (runDiskInspectionInput != null) + { + runDiskInspectionInput.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("runDiskInspectionInput", runDiskInspectionInput); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnostics/diskInspection/run").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_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(runDiskInspectionInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(runDiskInspectionInput, 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 != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _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 == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionOperationsExtensions.cs new file mode 100644 index 000000000000..16e54da24f53 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionOperationsExtensions.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiskInspectionOperations. + /// + public static partial class DiskInspectionOperationsExtensions + { + /// + /// Creates a request for executing disk Inspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection operation. + /// + public static string Create(this IDiskInspectionOperations operations, string location, RunDiskInspectionInput runDiskInspectionInput) + { + return operations.CreateAsync(location, runDiskInspectionInput).GetAwaiter().GetResult(); + } + + /// + /// Creates a request for executing disk Inspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IDiskInspectionOperations operations, string location, RunDiskInspectionInput runDiskInspectionInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(location, runDiskInspectionInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a specific Compute diagnostic for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + public static ComputeDiagnosticBase Get(this IDiskInspectionOperations operations, string location) + { + return operations.GetAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets a specific Compute diagnostic for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskInspectionOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a request for executing disk Inspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection operation. + /// + public static string BeginCreate(this IDiskInspectionOperations operations, string location, RunDiskInspectionInput runDiskInspectionInput) + { + return operations.BeginCreateAsync(location, runDiskInspectionInput).GetAwaiter().GetResult(); + } + + /// + /// Creates a request for executing disk Inspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IDiskInspectionOperations operations, string location, RunDiskInspectionInput runDiskInspectionInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(location, runDiskInspectionInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionStorageConfigurationOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionStorageConfigurationOperations.cs new file mode 100644 index 000000000000..718ae78960e7 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionStorageConfigurationOperations.cs @@ -0,0 +1,427 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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; + + /// + /// DiskInspectionStorageConfigurationOperations operations. + /// + internal partial class DiskInspectionStorageConfigurationOperations : IServiceOperations, IDiskInspectionStorageConfigurationOperations + { + /// + /// Initializes a new instance of the DiskInspectionStorageConfigurationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskInspectionStorageConfigurationOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Register a storageAccount for a subscription used for DiskInspection + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// Qualified name of the storage account + /// + /// + /// 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 RegisterWithHttpMessagesAsync(string location, string storageAccountId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (storageAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageAccountId"); + } + string apiVersion = "2021-06-01-preview"; + StorageConfigurationInput storageConfigurationInput = new StorageConfigurationInput(); + if (storageAccountId != null) + { + storageConfigurationInput.StorageAccountId = storageAccountId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("storageConfigurationInput", storageConfigurationInput); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Register", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnostics/diskInspection/registerStorageConfiguration").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_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(storageConfigurationInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(storageConfigurationInput, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _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; + } + + /// + /// Validate if a storageAccount configuration exists for a subscription used + /// for DiskInspection. + /// + /// + /// The location used to execute the diagnostic 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> ValidateWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnostics/diskInspection/validateStorageConfiguration").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _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/DiskInspectionStorageConfigurationOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionStorageConfigurationOperationsExtensions.cs new file mode 100644 index 000000000000..8c07ecef61cb --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskInspectionStorageConfigurationOperationsExtensions.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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiskInspectionStorageConfigurationOperations. + /// + public static partial class DiskInspectionStorageConfigurationOperationsExtensions + { + /// + /// Register a storageAccount for a subscription used for DiskInspection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// Qualified name of the storage account + /// + public static void Register(this IDiskInspectionStorageConfigurationOperations operations, string location, string storageAccountId) + { + operations.RegisterAsync(location, storageAccountId).GetAwaiter().GetResult(); + } + + /// + /// Register a storageAccount for a subscription used for DiskInspection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// Qualified name of the storage account + /// + /// + /// The cancellation token. + /// + public static async Task RegisterAsync(this IDiskInspectionStorageConfigurationOperations operations, string location, string storageAccountId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RegisterWithHttpMessagesAsync(location, storageAccountId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Validate if a storageAccount configuration exists for a subscription used + /// for DiskInspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + public static StorageConfigurationResponse Validate(this IDiskInspectionStorageConfigurationOperations operations, string location) + { + return operations.ValidateAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Validate if a storageAccount configuration exists for a subscription used + /// for DiskInspection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The cancellation token. + /// + public static async Task ValidateAsync(this IDiskInspectionStorageConfigurationOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs index f1535dd14c3b..0bcb058afc49 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs @@ -311,5 +311,25 @@ public partial interface IComputeManagementClient : System.IDisposable /// ICloudServiceOperatingSystemsOperations CloudServiceOperatingSystems { get; } + /// + /// Gets the IDiagnosticOperations. + /// + IDiagnosticOperations DiagnosticOperations { get; } + + /// + /// Gets the IDiskInspectionOperations. + /// + IDiskInspectionOperations DiskInspection { get; } + + /// + /// Gets the IDiagnosticsOperations. + /// + IDiagnosticsOperations Diagnostics { get; } + + /// + /// Gets the IDiskInspectionStorageConfigurationOperations. + /// + IDiskInspectionStorageConfigurationOperations DiskInspectionStorageConfiguration { get; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticOperations.cs new file mode 100644 index 000000000000..67c16a401f11 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticOperations.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiagnosticOperations operations. + /// + public partial interface IDiagnosticOperations + { + /// + /// Gets status of a Diagnostic operation issued for Disk Inspection. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The identifier pointing to a request for Disk Inspection. This is + /// used for polling result of the request. + /// + /// + /// 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 ReadWithHttpMessagesAsync(string location, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticsOperations.cs new file mode 100644 index 000000000000..ad7149989a10 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiagnosticsOperations.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiagnosticsOperations operations. + /// + public partial interface IDiagnosticsOperations + { + /// + /// Lists all available Compute diagnostics for a subscription in a + /// location. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available Compute diagnostics for a subscription in a + /// location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionOperations.cs new file mode 100644 index 000000000000..61570caffd99 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionOperations.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskInspectionOperations operations. + /// + public partial interface IDiskInspectionOperations + { + /// + /// Creates a request for executing disk Inspection. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection 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> CreateWithHttpMessagesAsync(string location, RunDiskInspectionInput runDiskInspectionInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a specific Compute diagnostic for a subscription in a + /// location. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a request for executing disk Inspection. + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// RunDiskInspection object supplied in the body of the Post run disk + /// inspection 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> BeginCreateWithHttpMessagesAsync(string location, RunDiskInspectionInput runDiskInspectionInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionStorageConfigurationOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionStorageConfigurationOperations.cs new file mode 100644 index 000000000000..3fa293da9390 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskInspectionStorageConfigurationOperations.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskInspectionStorageConfigurationOperations operations. + /// + public partial interface IDiskInspectionStorageConfigurationOperations + { + /// + /// Register a storageAccount for a subscription used for + /// DiskInspection + /// + /// + /// The location used to execute the diagnostic operation. + /// + /// + /// Qualified name of the storage account + /// + /// + /// 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 RegisterWithHttpMessagesAsync(string location, string storageAccountId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validate if a storageAccount configuration exists for a + /// subscription used for DiskInspection. + /// + /// + /// The location used to execute the diagnostic 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> ValidateWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComputeDiagnosticBase.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComputeDiagnosticBase.cs new file mode 100644 index 000000000000..da7e4946f2f4 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ComputeDiagnosticBase.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains metadata of a diagnostic type + /// + public partial class ComputeDiagnosticBase + { + /// + /// Initializes a new instance of the ComputeDiagnosticBase class. + /// + public ComputeDiagnosticBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeDiagnosticBase class. + /// + /// Identifier for the type of diagnostic + /// Friendly name for the type of diagnostic + /// Type of the diagnostic + public ComputeDiagnosticBase(string id = default(string), string name = default(string), string type = default(string), DiagnosticProperties properties = default(DiagnosticProperties)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets identifier for the type of diagnostic + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets friendly name for the type of diagnostic + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets type of the diagnostic + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public DiagnosticProperties Properties { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiagnosticProperties.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiagnosticProperties.cs new file mode 100644 index 000000000000..6a2cb5b35cd7 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiagnosticProperties.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; + + /// + /// Contains additional properties of a diagnostic + /// + public partial class DiagnosticProperties + { + /// + /// Initializes a new instance of the DiagnosticProperties class. + /// + public DiagnosticProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticProperties class. + /// + /// Describes what are the + /// supported resource types for a diagnostic. + public DiagnosticProperties(IList supportedResourceTypes = default(IList)) + { + SupportedResourceTypes = supportedResourceTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes what are the supported resource types for a + /// diagnostic. + /// + [JsonProperty(PropertyName = "supportedResourceTypes")] + public IList SupportedResourceTypes { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorDetail.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..21275ba789f8 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error Detail message. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The target of the particular error. + /// User friendly error message. + /// The Api error details + /// The Api inner error + public ErrorDetail(string code = default(string), string target = default(string), string message = default(string), IList details = default(IList), InnerError innerError = default(InnerError)) + { + Code = code; + Target = target; + Message = message; + Details = details; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the target of the particular error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets user friendly error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the Api error details + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + /// + /// Gets or sets the Api inner error + /// + [JsonProperty(PropertyName = "innerError")] + public InnerError InnerError { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponse.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..419f83319238 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An error response from the Compute Diagnostic Resource Provider + /// service. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponseException.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..5bc5eb0986b4 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResultStatus.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResultStatus.cs new file mode 100644 index 000000000000..8ca5d1e8acdd --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResultStatus.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ResultStatus. + /// + public static class ResultStatus + { + public const string Success = "Success"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionAsyncOperationResult.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionAsyncOperationResult.cs new file mode 100644 index 000000000000..6a8aa3807880 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionAsyncOperationResult.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Api output result when disk inspection result is completed. + /// + public partial class RunDiskInspectionAsyncOperationResult + { + /// + /// Initializes a new instance of the + /// RunDiskInspectionAsyncOperationResult class. + /// + public RunDiskInspectionAsyncOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RunDiskInspectionAsyncOperationResult class. + /// + /// Possible values include: 'Success', + /// 'Failed' + /// The time when the disk inspection was + /// completed. + public RunDiskInspectionAsyncOperationResult(string result = default(string), string resultStatus = default(string), ErrorDetail errorDetail = default(ErrorDetail), System.DateTime? createdUTC = default(System.DateTime?)) + { + Result = result; + ResultStatus = resultStatus; + ErrorDetail = errorDetail; + CreatedUTC = createdUTC; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "result")] + public string Result { get; set; } + + /// + /// Gets or sets possible values include: 'Success', 'Failed' + /// + [JsonProperty(PropertyName = "resultStatus")] + public string ResultStatus { get; set; } + + /// + /// + [JsonProperty(PropertyName = "errorDetail")] + public ErrorDetail ErrorDetail { get; set; } + + /// + /// Gets or sets the time when the disk inspection was completed. + /// + [JsonProperty(PropertyName = "createdUTC")] + public System.DateTime? CreatedUTC { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionInput.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionInput.cs new file mode 100644 index 000000000000..9292f358778c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/RunDiskInspectionInput.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data used for requesting a Disk Inspection execution. + /// + public partial class RunDiskInspectionInput + { + /// + /// Initializes a new instance of the RunDiskInspectionInput class. + /// + public RunDiskInspectionInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunDiskInspectionInput class. + /// + /// Qualified name of the resource. + /// Name of manifest in order to trigger Disk + /// Inspection. + /// SAS uri to the blob where results will + /// be uploaded. + public RunDiskInspectionInput(string resourceId, string manifest, string uploadSasUri) + { + ResourceId = resourceId; + Manifest = manifest; + UploadSasUri = uploadSasUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets qualified name of the resource. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets name of manifest in order to trigger Disk Inspection. + /// + [JsonProperty(PropertyName = "manifest")] + public string Manifest { get; set; } + + /// + /// Gets or sets SAS uri to the blob where results will be uploaded. + /// + [JsonProperty(PropertyName = "uploadSasUri")] + public string UploadSasUri { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); + } + if (Manifest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Manifest"); + } + if (UploadSasUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UploadSasUri"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationInput.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationInput.cs new file mode 100644 index 000000000000..8aaa72f9d584 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationInput.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data used for registering a Storage Account for a Subscription. + /// + public partial class StorageConfigurationInput + { + /// + /// Initializes a new instance of the StorageConfigurationInput class. + /// + public StorageConfigurationInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageConfigurationInput class. + /// + /// Qualified name of the storage + /// account + public StorageConfigurationInput(string storageAccountId) + { + StorageAccountId = storageAccountId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets qualified name of the storage account + /// + [JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageAccountId"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationResponse.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationResponse.cs new file mode 100644 index 000000000000..f09f706be5b6 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/StorageConfigurationResponse.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Api output result when there is an existing storage configuration + /// entry. + /// + public partial class StorageConfigurationResponse + { + /// + /// Initializes a new instance of the StorageConfigurationResponse + /// class. + /// + public StorageConfigurationResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageConfigurationResponse + /// class. + /// + public StorageConfigurationResponse(string storageAccountId = default(string)) + { + StorageAccountId = storageAccountId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId { 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 163acee7493a..2b70b5308923 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 @@ -32,8 +32,12 @@ public static IEnumerable> ApiInfo_ComputeManageme new Tuple("Compute", "CommunityGalleryImages", "2021-07-01"), new Tuple("Compute", "DedicatedHostGroups", "2021-11-01"), new Tuple("Compute", "DedicatedHosts", "2021-11-01"), + new Tuple("Compute", "DiagnosticOperations", "2021-06-01-preview"), + new Tuple("Compute", "Diagnostics", "2021-06-01-preview"), new Tuple("Compute", "DiskAccesses", "2021-12-01"), new Tuple("Compute", "DiskEncryptionSets", "2021-12-01"), + new Tuple("Compute", "DiskInspection", "2021-06-01-preview"), + new Tuple("Compute", "DiskInspectionStorageConfiguration", "2021-06-01-preview"), new Tuple("Compute", "DiskRestorePoint", "2021-12-01"), new Tuple("Compute", "Disks", "2021-12-01"), new Tuple("Compute", "Galleries", "2021-10-01"), diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj b/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj index 3b084c40f32e..77b1a1503e91 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj @@ -9,13 +9,13 @@ Provides developers with libraries for the updated compute platform under Azure Resource manager to deploy virtual machine, virtual machine extensions and availability set management capabilities. Launch, restart, scale, capture and manage VMs, VM Extensions and more. Note: This client library is for Virtual Machines under Azure Resource Manager. Development of this library has shifted focus to the Azure Unified SDK. The future development will be focused on "Azure.ResourceManager.Compute" (https://www.nuget.org/packages/Azure.ResourceManager.Compute/). Please see the package changelog for more information. - 54.0.0 + 54.1.0-preview.1 Microsoft.Azure.Management.Compute management;virtual machine;compute; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Properties/AssemblyInfo.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Properties/AssemblyInfo.cs index 599becf1b981..608152d3cf51 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Properties/AssemblyInfo.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Compute Resources.")] [assembly: AssemblyVersion("54.0.0")] -[assembly: AssemblyFileVersion("54.0.0")] +[assembly: AssemblyFileVersion("54.1.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")]