diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesOperations.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesOperations.cs index 3677a3cc8da1..addafd13b47c 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesOperations.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesOperations.cs @@ -56,5 +56,32 @@ public partial interface IRecoveryServicesOperations /// Thrown when a required parameter is null /// Task> CheckNameAvailabilityWithHttpMessagesAsync(string resourceGroupName, string location, CheckNameAvailabilityParameters input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// API to get details about capabilities provided by + /// Microsoft.RecoveryServices RP + /// + /// + /// Location of the resource + /// + /// + /// Contains information about Resource type and properties to get + /// capabilities + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CapabilitiesWithHttpMessagesAsync(string location, ResourceCapabilities input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/BackupStorageVersion.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/BackupStorageVersion.cs new file mode 100644 index 000000000000..0e83b4890b06 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/BackupStorageVersion.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + + /// + /// Defines values for BackupStorageVersion. + /// + public static class BackupStorageVersion + { + public const string V1 = "V1"; + public const string V2 = "V2"; + public const string Unassigned = "Unassigned"; + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesProperties.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesProperties.cs new file mode 100644 index 000000000000..daeb9762ecd9 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesProperties.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Capabilities information + /// + public partial class CapabilitiesProperties + { + /// + /// Initializes a new instance of the CapabilitiesProperties class. + /// + public CapabilitiesProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapabilitiesProperties class. + /// + public CapabilitiesProperties(IList dnsZones = default(IList)) + { + DnsZones = dnsZones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "dnsZones")] + public IList DnsZones { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesResponse.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesResponse.cs new file mode 100644 index 000000000000..dfbca3e231b9 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesResponse.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.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Capabilities response for Microsoft.RecoveryServices + /// + public partial class CapabilitiesResponse : ResourceCapabilitiesBase + { + /// + /// Initializes a new instance of the CapabilitiesResponse class. + /// + public CapabilitiesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapabilitiesResponse class. + /// + /// Describes the Resource type: + /// Microsoft.RecoveryServices/Vaults + public CapabilitiesResponse(string type, CapabilitiesResponseProperties properties = default(CapabilitiesResponseProperties)) + : base(type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CapabilitiesResponseProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesResponseProperties.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesResponseProperties.cs new file mode 100644 index 000000000000..90622503347f --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CapabilitiesResponseProperties.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Capabilities properties in response + /// + public partial class CapabilitiesResponseProperties + { + /// + /// Initializes a new instance of the CapabilitiesResponseProperties + /// class. + /// + public CapabilitiesResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapabilitiesResponseProperties + /// class. + /// + public CapabilitiesResponseProperties(IList dnsZones = default(IList)) + { + DnsZones = dnsZones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "dnsZones")] + public IList DnsZones { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/DNSZone.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/DNSZone.cs new file mode 100644 index 000000000000..6c510a40b86a --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/DNSZone.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.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// DNSZone information + /// + public partial class DNSZone + { + /// + /// Initializes a new instance of the DNSZone class. + /// + public DNSZone() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DNSZone class. + /// + /// Subresource type for vault, AzureBackup + /// or AzureSiteRecovery. Possible values include: 'AzureBackup', + /// 'AzureSiteRecovery' + public DNSZone(string subResource = default(string)) + { + SubResource = subResource; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets subresource type for vault, AzureBackup or + /// AzureSiteRecovery. Possible values include: 'AzureBackup', + /// 'AzureSiteRecovery' + /// + [JsonProperty(PropertyName = "subResource")] + public string SubResource { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/DNSZoneResponse.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/DNSZoneResponse.cs new file mode 100644 index 000000000000..8766ee8e3818 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/DNSZoneResponse.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// DNSZone information for Microsoft.RecoveryServices + /// + public partial class DNSZoneResponse : DNSZone + { + /// + /// Initializes a new instance of the DNSZoneResponse class. + /// + public DNSZoneResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DNSZoneResponse class. + /// + /// Subresource type for vault, AzureBackup + /// or AzureSiteRecovery. Possible values include: 'AzureBackup', + /// 'AzureSiteRecovery' + /// The private link resource Private + /// link DNS zone name. + public DNSZoneResponse(string subResource = default(string), IList requiredZoneNames = default(IList)) + : base(subResource) + { + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the private link resource Private link DNS zone name. + /// + [JsonProperty(PropertyName = "requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCapabilities.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCapabilities.cs new file mode 100644 index 000000000000..00b75c37c5f6 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCapabilities.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.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input to get capabilities information for Microsoft.RecoveryServices + /// + public partial class ResourceCapabilities : ResourceCapabilitiesBase + { + /// + /// Initializes a new instance of the ResourceCapabilities class. + /// + public ResourceCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceCapabilities class. + /// + /// Describes the Resource type: + /// Microsoft.RecoveryServices/Vaults + public ResourceCapabilities(string type, CapabilitiesProperties properties = default(CapabilitiesProperties)) + : base(type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CapabilitiesProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCapabilitiesBase.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCapabilitiesBase.cs new file mode 100644 index 000000000000..b222e508e498 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCapabilitiesBase.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base class for request and response capabilities information for + /// Microsoft.RecoveryServices + /// + public partial class ResourceCapabilitiesBase + { + /// + /// Initializes a new instance of the ResourceCapabilitiesBase class. + /// + public ResourceCapabilitiesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceCapabilitiesBase class. + /// + /// Describes the Resource type: + /// Microsoft.RecoveryServices/Vaults + public ResourceCapabilitiesBase(string type) + { + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the Resource type: + /// Microsoft.RecoveryServices/Vaults + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs index 37c19cb40a7e..e936996908a7 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs @@ -48,7 +48,9 @@ public VaultProperties() /// 'PrepareFailed', 'CommitFailed', 'PrepareTimedout', /// 'CommitTimedout', 'MoveSucceeded', 'Failure', 'CriticalFailure', /// 'PartialSuccess' - public VaultProperties(string provisioningState = default(string), UpgradeDetails upgradeDetails = default(UpgradeDetails), IList privateEndpointConnections = default(IList), string privateEndpointStateForBackup = default(string), string privateEndpointStateForSiteRecovery = default(string), VaultPropertiesEncryption encryption = default(VaultPropertiesEncryption), VaultPropertiesMoveDetails moveDetails = default(VaultPropertiesMoveDetails), string moveState = default(string)) + /// Backup storage version. Possible + /// values include: 'V1', 'V2', 'Unassigned' + public VaultProperties(string provisioningState = default(string), UpgradeDetails upgradeDetails = default(UpgradeDetails), IList privateEndpointConnections = default(IList), string privateEndpointStateForBackup = default(string), string privateEndpointStateForSiteRecovery = default(string), VaultPropertiesEncryption encryption = default(VaultPropertiesEncryption), VaultPropertiesMoveDetails moveDetails = default(VaultPropertiesMoveDetails), string moveState = default(string), string backupStorageVersion = default(string)) { ProvisioningState = provisioningState; UpgradeDetails = upgradeDetails; @@ -58,6 +60,7 @@ public VaultProperties() Encryption = encryption; MoveDetails = moveDetails; MoveState = moveState; + BackupStorageVersion = backupStorageVersion; CustomInit(); } @@ -119,5 +122,12 @@ public VaultProperties() [JsonProperty(PropertyName = "moveState")] public string MoveState { get; private set; } + /// + /// Gets backup storage version. Possible values include: 'V1', 'V2', + /// 'Unassigned' + /// + [JsonProperty(PropertyName = "backupStorageVersion")] + public string BackupStorageVersion { get; private set; } + } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultSubResourceType.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultSubResourceType.cs new file mode 100644 index 000000000000..6ae4a1bc5d6b --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultSubResourceType.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.RecoveryServices.Models +{ + + /// + /// Defines values for VaultSubResourceType. + /// + public static class VaultSubResourceType + { + public const string AzureBackup = "AzureBackup"; + public const string AzureSiteRecovery = "AzureSiteRecovery"; + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs index 2ee49c677178..6ef6f3cc3523 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs @@ -372,7 +372,7 @@ private void Initialize() VaultExtendedInfo = new VaultExtendedInfoOperations(this); Usages = new UsagesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-06-01"; + ApiVersion = "2022-01-31-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperations.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperations.cs index e8597990c0ad..bb10853066e6 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperations.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperations.cs @@ -265,5 +265,211 @@ internal RecoveryServicesOperations(RecoveryServicesClient client) return _result; } + /// + /// API to get details about capabilities provided by + /// Microsoft.RecoveryServices RP + /// + /// + /// Location of the resource + /// + /// + /// Contains information about Resource type and properties to get capabilities + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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> CapabilitiesWithHttpMessagesAsync(string location, ResourceCapabilities input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (input == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "input"); + } + if (input != null) + { + input.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("input", input); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Capabilities", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{location}/capabilities").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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(input != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(input, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperationsExtensions.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperationsExtensions.cs index 617f09a30e7d..625d76ad4d7a 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperationsExtensions.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesOperationsExtensions.cs @@ -77,5 +77,47 @@ public static CheckNameAvailabilityResult CheckNameAvailability(this IRecoverySe } } + /// + /// API to get details about capabilities provided by + /// Microsoft.RecoveryServices RP + /// + /// + /// The operations group for this extension method. + /// + /// + /// Location of the resource + /// + /// + /// Contains information about Resource type and properties to get capabilities + /// + public static CapabilitiesResponse Capabilities(this IRecoveryServicesOperations operations, string location, ResourceCapabilities input) + { + return operations.CapabilitiesAsync(location, input).GetAwaiter().GetResult(); + } + + /// + /// API to get details about capabilities provided by + /// Microsoft.RecoveryServices RP + /// + /// + /// The operations group for this extension method. + /// + /// + /// Location of the resource + /// + /// + /// Contains information about Resource type and properties to get capabilities + /// + /// + /// The cancellation token. + /// + public static async Task CapabilitiesAsync(this IRecoveryServicesOperations operations, string location, ResourceCapabilities input, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CapabilitiesWithHttpMessagesAsync(location, input, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs index 4bf4069bf025..dd2d58180748 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs @@ -19,30 +19,19 @@ public static IEnumerable> ApiInfo_RecoveryService { return new Tuple[] { - new Tuple("RecoveryServices", "GetOperationResult", "2021-06-01"), - new Tuple("RecoveryServices", "GetOperationStatus", "2021-06-01"), - new Tuple("RecoveryServices", "Operations", "2021-06-01"), - new Tuple("RecoveryServices", "PrivateLinkResources", "2021-06-01"), - new Tuple("RecoveryServices", "RecoveryServices", "2021-06-01"), - new Tuple("RecoveryServices", "RegisteredIdentities", "2021-06-01"), - new Tuple("RecoveryServices", "ReplicationUsages", "2021-06-01"), - new Tuple("RecoveryServices", "Usages", "2021-06-01"), - new Tuple("RecoveryServices", "VaultCertificates", "2021-06-01"), - new Tuple("RecoveryServices", "VaultExtendedInfo", "2021-06-01"), - new Tuple("RecoveryServices", "Vaults", "2021-06-01"), + new Tuple("RecoveryServices", "GetOperationResult", "2022-01-31-preview"), + new Tuple("RecoveryServices", "GetOperationStatus", "2022-01-31-preview"), + new Tuple("RecoveryServices", "Operations", "2022-01-31-preview"), + new Tuple("RecoveryServices", "PrivateLinkResources", "2022-01-31-preview"), + new Tuple("RecoveryServices", "RecoveryServices", "2022-01-31-preview"), + new Tuple("RecoveryServices", "RegisteredIdentities", "2022-01-31-preview"), + new Tuple("RecoveryServices", "ReplicationUsages", "2022-01-31-preview"), + new Tuple("RecoveryServices", "Usages", "2022-01-31-preview"), + new Tuple("RecoveryServices", "VaultCertificates", "2022-01-31-preview"), + new Tuple("RecoveryServices", "VaultExtendedInfo", "2022-01-31-preview"), + new Tuple("RecoveryServices", "Vaults", "2022-01-31-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "V2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@3.1.5"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/recoveryservices/resource-manager/readme.md --csharp --version=V2 --reflect-api-versions --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "70626b932d16a97361673e0bcba7570284fe0813"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -