From 13b234c540a0aea1e289934efb2c1915e21d02d4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 31 Aug 2021 23:07:59 +0000 Subject: [PATCH] CodeGen from PR 15874 in Azure/azure-rest-api-specs Merge d2a42d8f79beba941b23d8af1721775633b09dea into ff1530a77c9c21e515930f7f20166fa6609dba49 --- .../Generated/AzureArcDataManagementClient.cs | 377 ++++ .../Generated/DataControllersOperations.cs | 1576 ++++++++++++++++ .../DataControllersOperationsExtensions.cs | 397 +++++ .../IAzureArcDataManagementClient.cs | 94 + .../Generated/IDataControllersOperations.cs | 259 +++ .../src/Generated/IOperations.cs | 70 + .../ISqlManagedInstancesOperations.cs | 271 +++ .../ISqlServerInstancesOperations.cs | 271 +++ .../ArcSqlManagedInstanceLicenseType.cs | 60 + .../Models/ArcSqlServerLicenseType.cs | 24 + .../Generated/Models/BasicLoginInformation.cs | 59 + .../src/Generated/Models/CommonSku.cs | 96 + .../src/Generated/Models/ConnectionStatus.cs | 23 + .../Models/DataControllerProperties.cs | 131 ++ .../Models/DataControllerResource.cs | 72 + .../Generated/Models/DataControllerUpdate.cs | 53 + .../src/Generated/Models/DefenderStatus.cs | 23 + .../src/Generated/Models/EditionType.cs | 26 + .../src/Generated/Models/ErrorResponse.cs | 51 + .../src/Generated/Models/ErrorResponseBody.cs | 84 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/ExtendedLocation.cs | 61 + .../Generated/Models/ExtendedLocationTypes.cs | 21 + .../src/Generated/Models/Identity.cs | 70 + .../src/Generated/Models/IdentityType.cs | 24 + .../src/Generated/Models/Infrastructure.cs | 84 + .../Models/K8sResourceRequirements.cs | 88 + .../src/Generated/Models/K8sScheduling.cs | 61 + .../Generated/Models/K8sSchedulingOptions.cs | 62 + .../Models/LogAnalyticsWorkspaceConfig.cs | 61 + .../src/Generated/Models/ODataError.cs | 79 + .../src/Generated/Models/OnPremiseProperty.cs | 74 + .../src/Generated/Models/Operation.cs | 93 + .../src/Generated/Models/OperationDisplay.cs | 81 + .../src/Generated/Models/OperationOrigin.cs | 22 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/Plan.cs | 94 + .../src/Generated/Models/ProxyResource.cs | 50 + .../src/Generated/Models/Resource.cs | 72 + .../Generated/Models/ResourceIdentityType.cs | 54 + .../src/Generated/Models/ResourceSku.cs | 70 + .../Generated/Models/SqlManagedInstance.cs | 80 + .../Models/SqlManagedInstanceK8sRaw.cs | 61 + .../Models/SqlManagedInstanceK8sSpec.cs | 77 + .../Models/SqlManagedInstanceProperties.cs | 143 ++ .../Generated/Models/SqlManagedInstanceSku.cs | 100 ++ .../Models/SqlManagedInstanceSkuTier.cs | 60 + .../Models/SqlManagedInstanceUpdate.cs | 53 + .../src/Generated/Models/SqlServerInstance.cs | 63 + .../Models/SqlServerInstanceProperties.cs | 200 +++ .../Models/SqlServerInstanceUpdate.cs | 53 + .../src/Generated/Models/SqlVersion.cs | 23 + .../src/Generated/Models/SystemData.cs | 105 ++ .../src/Generated/Models/TrackedResource.cs | 75 + .../Models/UploadServicePrincipal.cs | 78 + .../src/Generated/Models/UploadWatermark.cs | 74 + .../src/Generated/Operations.cs | 390 ++++ .../src/Generated/OperationsExtensions.cs | 87 + .../SdkInfo_AzureArcDataManagementClient.cs | 30 + .../SqlManagedInstancesOperations.cs | 1588 +++++++++++++++++ ...SqlManagedInstancesOperationsExtensions.cs | 421 +++++ .../Generated/SqlServerInstancesOperations.cs | 1588 +++++++++++++++++ .../SqlServerInstancesOperationsExtensions.cs | 421 +++++ 63 files changed, 11123 insertions(+) create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Identity.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/IdentityType.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ODataError.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Plan.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceIdentityType.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceSku.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs create mode 100644 sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs new file mode 100644 index 000000000000..a02be1a3ab21 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs @@ -0,0 +1,377 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// The AzureArcData management API provides a RESTful set of web APIs to + /// manage Azure Data Services on Azure Arc Resources. + /// + public partial class AzureArcDataManagementClient : ServiceClient, IAzureArcDataManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The ID of the Azure subscription + /// + public string SubscriptionId { get; set; } + + /// + /// The API version to use for the request + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the ISqlManagedInstancesOperations. + /// + public virtual ISqlManagedInstancesOperations SqlManagedInstances { get; private set; } + + /// + /// Gets the ISqlServerInstancesOperations. + /// + public virtual ISqlServerInstancesOperations SqlServerInstances { get; private set; } + + /// + /// Gets the IDataControllersOperations. + /// + public virtual IDataControllersOperations DataControllers { get; private set; } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureArcDataManagementClient.Dispose(). False: will not dispose provided httpClient + protected AzureArcDataManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureArcDataManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureArcDataManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected AzureArcDataManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected AzureArcDataManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureArcDataManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Operations = new Operations(this); + SqlManagedInstances = new SqlManagedInstancesOperations(this); + SqlServerInstances = new SqlServerInstancesOperations(this); + DataControllers = new DataControllersOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-08-01"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs new file mode 100644 index 000000000000..beadca46bca1 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs @@ -0,0 +1,1576 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + 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; + + /// + /// DataControllersOperations operations. + /// + internal partial class DataControllersOperations : IServiceOperations, IDataControllersOperations + { + /// + /// Initializes a new instance of the DataControllersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DataControllersOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List dataController resources in the subscription + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListInSubscriptionWithHttpMessagesAsync(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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListInSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("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; + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The name of the Azure resource group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListInGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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("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 or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPutDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerResource, dataControllerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDataController", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + 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("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; + } + + /// + /// Updates a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// Resource tags + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PatchDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + DataControllerUpdate dataControllerResource = new DataControllerUpdate(); + if (tags != null) + { + dataControllerResource.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("dataControllerResource", dataControllerResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PatchDataController", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(dataControllerResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataControllerResource, 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(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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> BeginPutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerResource"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerResource", dataControllerResource); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPutDataController", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + 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("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(dataControllerResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataControllerResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteDataController", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + 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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// List dataController resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListInSubscriptionNextWithHttpMessagesAsync(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, "ListInSubscriptionNext", 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; + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListInGroupNextWithHttpMessagesAsync(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, "ListInGroupNext", 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/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs new file mode 100644 index 000000000000..d4b27388a959 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs @@ -0,0 +1,397 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataControllersOperations. + /// + public static partial class DataControllersOperationsExtensions + { + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListInSubscription(this IDataControllersOperations operations) + { + return operations.ListInSubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IDataControllersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInSubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListInGroup(this IDataControllersOperations operations, string resourceGroupName) + { + return operations.ListInGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListInGroupAsync(this IDataControllersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + public static DataControllerResource PutDataController(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName) + { + return operations.PutDataControllerAsync(resourceGroupName, dataControllerResource, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task PutDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerResource, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + public static void DeleteDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName) + { + operations.DeleteDataControllerAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + public static DataControllerResource GetDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName) + { + return operations.GetDataControllerAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// Resource tags + /// + public static DataControllerResource PatchDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, IDictionary tags = default(IDictionary)) + { + return operations.PatchDataControllerAsync(resourceGroupName, dataControllerName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task PatchDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PatchDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + public static DataControllerResource BeginPutDataController(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName) + { + return operations.BeginPutDataControllerAsync(resourceGroupName, dataControllerResource, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginPutDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPutDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerResource, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + public static void BeginDeleteDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName) + { + operations.BeginDeleteDataControllerAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListInSubscriptionNext(this IDataControllersOperations operations, string nextPageLink) + { + return operations.ListInSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionNextAsync(this IDataControllersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListInGroupNext(this IDataControllersOperations operations, string nextPageLink) + { + return operations.ListInGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInGroupNextAsync(this IDataControllersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs new file mode 100644 index 000000000000..cafec8081c6c --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// The AzureArcData management API provides a RESTful set of web APIs to + /// manage Azure Data Services on Azure Arc Resources. + /// + public partial interface IAzureArcDataManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The ID of the Azure subscription + /// + string SubscriptionId { get; set; } + + /// + /// The API version to use for the request + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the ISqlManagedInstancesOperations. + /// + ISqlManagedInstancesOperations SqlManagedInstances { get; } + + /// + /// Gets the ISqlServerInstancesOperations. + /// + ISqlServerInstancesOperations SqlServerInstances { get; } + + /// + /// Gets the IDataControllersOperations. + /// + IDataControllersOperations DataControllers { get; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs new file mode 100644 index 000000000000..0e8f4163c3d1 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs @@ -0,0 +1,259 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataControllersOperations operations. + /// + public partial interface IDataControllersOperations + { + /// + /// List dataController resources in the subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInSubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dataController resources in the resource group + /// + /// + /// The name of the Azure resource group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PatchDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginPutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dataController resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dataController resources in the resource group + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs new file mode 100644 index 000000000000..5965cad855a9 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available Azure Data Services on Azure Arc API + /// operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available Azure Data Services on Azure Arc API + /// operations. + /// + /// + /// 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/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs new file mode 100644 index 000000000000..45659cdc2787 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs @@ -0,0 +1,271 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlManagedInstancesOperations operations. + /// + public partial interface ISqlManagedInstancesOperations + { + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlManagedInstance + /// + /// + /// Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs new file mode 100644 index 000000000000..95e640b61baf --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs @@ -0,0 +1,271 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlServerInstancesOperations operations. + /// + public partial interface ISqlServerInstancesOperations + { + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlServerInstance + /// + /// + /// Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs new file mode 100644 index 000000000000..15fcb1fbf4e6 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ArcSqlManagedInstanceLicenseType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArcSqlManagedInstanceLicenseType + { + [EnumMember(Value = "BasePrice")] + BasePrice, + [EnumMember(Value = "LicenseIncluded")] + LicenseIncluded + } + internal static class ArcSqlManagedInstanceLicenseTypeEnumExtension + { + internal static string ToSerializedValue(this ArcSqlManagedInstanceLicenseType? value) + { + return value == null ? null : ((ArcSqlManagedInstanceLicenseType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ArcSqlManagedInstanceLicenseType value) + { + switch( value ) + { + case ArcSqlManagedInstanceLicenseType.BasePrice: + return "BasePrice"; + case ArcSqlManagedInstanceLicenseType.LicenseIncluded: + return "LicenseIncluded"; + } + return null; + } + + internal static ArcSqlManagedInstanceLicenseType? ParseArcSqlManagedInstanceLicenseType(this string value) + { + switch( value ) + { + case "BasePrice": + return ArcSqlManagedInstanceLicenseType.BasePrice; + case "LicenseIncluded": + return ArcSqlManagedInstanceLicenseType.LicenseIncluded; + } + return null; + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs new file mode 100644 index 000000000000..a69437ba684d --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for ArcSqlServerLicenseType. + /// + public static class ArcSqlServerLicenseType + { + public const string Paid = "Paid"; + public const string Free = "Free"; + public const string HADR = "HADR"; + public const string Undefined = "Undefined"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs new file mode 100644 index 000000000000..b8369bc86e10 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Username and password for basic login authentication. + /// + public partial class BasicLoginInformation + { + /// + /// Initializes a new instance of the BasicLoginInformation class. + /// + public BasicLoginInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BasicLoginInformation class. + /// + /// Login username. + /// Login password. + public BasicLoginInformation(string username = default(string), string password = default(string)) + { + Username = username; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets login username. + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets login password. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs new file mode 100644 index 000000000000..b151c196c8db --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition representing SKU for ARM resources + /// + public partial class CommonSku + { + /// + /// Initializes a new instance of the CommonSku class. + /// + public CommonSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommonSku class. + /// + /// The name of the SKU. It is typically a + /// letter+number code + /// Whether dev/test is enabled. When the dev field + /// is set to true, the resource is used for dev/test purpose. + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + public CommonSku(string name, bool? dev = default(bool?), string size = default(string), string family = default(string), int? capacity = default(int?)) + { + Name = name; + Dev = dev; + Size = size; + Family = family; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the SKU. It is typically a letter+number + /// code + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets whether dev/test is enabled. When the dev field is set + /// to true, the resource is used for dev/test purpose. + /// + [JsonProperty(PropertyName = "dev")] + public bool? Dev { get; set; } + + /// + /// Gets or sets the SKU size. When the name field is the combination + /// of tier and some other value, this would be the standalone code. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// Gets or sets if the service has different generations of hardware, + /// for the same SKU, then that can be captured here. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets if the SKU supports scale out/in then the capacity + /// integer should be included. If scale out/in is not possible for the + /// resource this may be omitted. + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs new file mode 100644 index 000000000000..30381e16c88d --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.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.AzureArcData.Models +{ + + /// + /// Defines values for ConnectionStatus. + /// + public static class ConnectionStatus + { + public const string Connected = "Connected"; + public const string Disconnected = "Disconnected"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs new file mode 100644 index 000000000000..31d0b782f4c0 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The data controller properties. + /// + public partial class DataControllerProperties + { + /// + /// Initializes a new instance of the DataControllerProperties class. + /// + public DataControllerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataControllerProperties class. + /// + /// The infrastructure the data controller + /// is running on. Possible values include: 'azure', 'gcp', 'aws', + /// 'alibaba', 'onpremises', 'other' + /// The raw kubernetes information + /// Last uploaded date from Kubernetes + /// cluster. Defaults to current date time + /// If a CustomLocation is provided, this + /// contains the ARM id of the connected cluster the custom location + /// belongs to. + /// If a CustomLocation is provided, this + /// contains the ARM id of the extension the custom location belongs + /// to. + public DataControllerProperties(Infrastructure? infrastructure = default(Infrastructure?), OnPremiseProperty onPremiseProperty = default(OnPremiseProperty), object k8sRaw = default(object), UploadWatermark uploadWatermark = default(UploadWatermark), System.DateTime? lastUploadedDate = default(System.DateTime?), BasicLoginInformation basicLoginInformation = default(BasicLoginInformation), LogAnalyticsWorkspaceConfig logAnalyticsWorkspaceConfig = default(LogAnalyticsWorkspaceConfig), UploadServicePrincipal uploadServicePrincipal = default(UploadServicePrincipal), string provisioningState = default(string), string clusterId = default(string), string extensionId = default(string)) + { + Infrastructure = infrastructure; + OnPremiseProperty = onPremiseProperty; + K8sRaw = k8sRaw; + UploadWatermark = uploadWatermark; + LastUploadedDate = lastUploadedDate; + BasicLoginInformation = basicLoginInformation; + LogAnalyticsWorkspaceConfig = logAnalyticsWorkspaceConfig; + UploadServicePrincipal = uploadServicePrincipal; + ProvisioningState = provisioningState; + ClusterId = clusterId; + ExtensionId = extensionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the infrastructure the data controller is running on. + /// Possible values include: 'azure', 'gcp', 'aws', 'alibaba', + /// 'onpremises', 'other' + /// + [JsonProperty(PropertyName = "infrastructure")] + public Infrastructure? Infrastructure { get; set; } + + /// + /// + [JsonProperty(PropertyName = "onPremiseProperty")] + public OnPremiseProperty OnPremiseProperty { get; set; } + + /// + /// Gets or sets the raw kubernetes information + /// + [JsonProperty(PropertyName = "k8sRaw")] + public object K8sRaw { get; set; } + + /// + /// + [JsonProperty(PropertyName = "uploadWatermark")] + public UploadWatermark UploadWatermark { get; set; } + + /// + /// Gets or sets last uploaded date from Kubernetes cluster. Defaults + /// to current date time + /// + [JsonProperty(PropertyName = "lastUploadedDate")] + public System.DateTime? LastUploadedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "basicLoginInformation")] + public BasicLoginInformation BasicLoginInformation { get; set; } + + /// + /// + [JsonProperty(PropertyName = "logAnalyticsWorkspaceConfig")] + public LogAnalyticsWorkspaceConfig LogAnalyticsWorkspaceConfig { get; set; } + + /// + /// + [JsonProperty(PropertyName = "uploadServicePrincipal")] + public UploadServicePrincipal UploadServicePrincipal { get; set; } + + /// + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the connected cluster the custom location belongs to. + /// + [JsonProperty(PropertyName = "clusterId")] + public string ClusterId { get; set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the extension the custom location belongs to. + /// + [JsonProperty(PropertyName = "extensionId")] + public string ExtensionId { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs new file mode 100644 index 000000000000..da7112d83595 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Data controller resource + /// + public partial class DataControllerResource : TrackedResource + { + /// + /// Initializes a new instance of the DataControllerResource class. + /// + public DataControllerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataControllerResource class. + /// + /// The geo-location where the resource + /// lives + /// The data controller's properties + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// The extendedLocation of the + /// resource. + public DataControllerResource(string location, DataControllerProperties properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags, systemData) + { + ExtendedLocation = extendedLocation; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the extendedLocation of the resource. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets or sets the data controller's properties + /// + [JsonProperty(PropertyName = "properties")] + public DataControllerProperties Properties { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs new file mode 100644 index 000000000000..79802e74c7f1 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Used for updating a data controller resource. + /// + public partial class DataControllerUpdate + { + /// + /// Initializes a new instance of the DataControllerUpdate class. + /// + public DataControllerUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataControllerUpdate class. + /// + /// Resource tags + public DataControllerUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs new file mode 100644 index 000000000000..caad97050980 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.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.AzureArcData.Models +{ + + /// + /// Defines values for DefenderStatus. + /// + public static class DefenderStatus + { + public const string Protected = "Protected"; + public const string Unprotected = "Unprotected"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs new file mode 100644 index 000000000000..eea7f782bf36 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for EditionType. + /// + public static class EditionType + { + public const string Evaluation = "Evaluation"; + public const string Enterprise = "Enterprise"; + public const string Standard = "Standard"; + public const string Web = "Web"; + public const string Developer = "Developer"; + public const string Express = "Express"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..a7dc6e20f72d --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An error response from the Azure Data on Azure Arc service. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// null + public ErrorResponse(ErrorResponseBody error = default(ErrorResponseBody)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "error")] + public ErrorResponseBody Error { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs new file mode 100644 index 000000000000..c8ccab35c370 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An error response from the Batch service. + /// + public partial class ErrorResponseBody + { + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + public ErrorResponseBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + /// An identifier for the error. Codes are invariant + /// and are intended to be consumed programmatically. + /// A message describing the error, intended to + /// be suitable for display in a user interface. + /// The target of the particular error. For + /// example, the name of the property in error. + /// A list of additional details about the + /// error. + public ErrorResponseBody(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an identifier for the error. Codes are invariant and + /// are intended to be consumed programmatically. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets a message describing the error, intended to be + /// suitable for display in a user interface. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the target of the particular error. For example, the + /// name of the property in error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets a list of additional details about the error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..d3c8a4b94e71 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/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.AzureArcData.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/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs new file mode 100644 index 000000000000..a85bda3f8db6 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The complex type of the extended location. + /// + public partial class ExtendedLocation + { + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + public ExtendedLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + /// The name of the extended location. + /// The type of the extended location. Possible + /// values include: 'CustomLocation' + public ExtendedLocation(string name = default(string), string type = default(string)) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extended location. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the type of the extended location. Possible values + /// include: 'CustomLocation' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs new file mode 100644 index 000000000000..6dad751b48c6 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for ExtendedLocationTypes. + /// + public static class ExtendedLocationTypes + { + public const string CustomLocation = "CustomLocation"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Identity.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Identity.cs new file mode 100644 index 000000000000..ff2fd4fdd68a --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Identity.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Identity for the resource. + /// + public partial class Identity + { + /// + /// Initializes a new instance of the Identity class. + /// + public Identity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Identity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public Identity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of resource identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the identity type. Possible values include: + /// 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/IdentityType.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/IdentityType.cs new file mode 100644 index 000000000000..c9a3f1c46373 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/IdentityType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for IdentityType. + /// + public static class IdentityType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs new file mode 100644 index 000000000000..1d806b0447e1 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for Infrastructure. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Infrastructure + { + [EnumMember(Value = "azure")] + Azure, + [EnumMember(Value = "gcp")] + Gcp, + [EnumMember(Value = "aws")] + Aws, + [EnumMember(Value = "alibaba")] + Alibaba, + [EnumMember(Value = "onpremises")] + Onpremises, + [EnumMember(Value = "other")] + Other + } + internal static class InfrastructureEnumExtension + { + internal static string ToSerializedValue(this Infrastructure? value) + { + return value == null ? null : ((Infrastructure)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this Infrastructure value) + { + switch( value ) + { + case Infrastructure.Azure: + return "azure"; + case Infrastructure.Gcp: + return "gcp"; + case Infrastructure.Aws: + return "aws"; + case Infrastructure.Alibaba: + return "alibaba"; + case Infrastructure.Onpremises: + return "onpremises"; + case Infrastructure.Other: + return "other"; + } + return null; + } + + internal static Infrastructure? ParseInfrastructure(this string value) + { + switch( value ) + { + case "azure": + return Infrastructure.Azure; + case "gcp": + return Infrastructure.Gcp; + case "aws": + return Infrastructure.Aws; + case "alibaba": + return Infrastructure.Alibaba; + case "onpremises": + return Infrastructure.Onpremises; + case "other": + return Infrastructure.Other; + } + return null; + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs new file mode 100644 index 000000000000..95c23fb027b1 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes resource limits and requests used to restrict or reserve + /// resource usage. + /// + public partial class K8sResourceRequirements + { + /// + /// Initializes a new instance of the K8sResourceRequirements class. + /// + public K8sResourceRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the K8sResourceRequirements class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// Requests for a kubernetes resource type (e.g + /// 'cpu', 'memory'). The 'cpu' request must be less than or equal to + /// 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is + /// '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum + /// 'cpu' is 24 and maximum 'memory' is '128Gi'. + /// Limits for a kubernetes resource type (e.g + /// 'cpu', 'memory'). The 'cpu' request must be less than or equal to + /// 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is + /// '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum + /// 'cpu' is 24 and maximum 'memory' is '128Gi'. + public K8sResourceRequirements(IDictionary additionalProperties = default(IDictionary), IDictionary requests = default(IDictionary), IDictionary limits = default(IDictionary)) + { + AdditionalProperties = additionalProperties; + Requests = requests; + Limits = limits; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Gets or sets requests for a kubernetes resource type (e.g 'cpu', + /// 'memory'). The 'cpu' request must be less than or equal to 'cpu' + /// limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', + /// minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 + /// and maximum 'memory' is '128Gi'. + /// + [JsonProperty(PropertyName = "requests")] + public IDictionary Requests { get; set; } + + /// + /// Gets or sets limits for a kubernetes resource type (e.g 'cpu', + /// 'memory'). The 'cpu' request must be less than or equal to 'cpu' + /// limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', + /// minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 + /// and maximum 'memory' is '128Gi'. + /// + [JsonProperty(PropertyName = "limits")] + public IDictionary Limits { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs new file mode 100644 index 000000000000..db19e7aa84cc --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes scheduling information. + /// + public partial class K8sScheduling + { + /// + /// Initializes a new instance of the K8sScheduling class. + /// + public K8sScheduling() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the K8sScheduling class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + public K8sScheduling(IDictionary additionalProperties = default(IDictionary), K8sSchedulingOptions defaultProperty = default(K8sSchedulingOptions)) + { + AdditionalProperties = additionalProperties; + DefaultProperty = defaultProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "default")] + public K8sSchedulingOptions DefaultProperty { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs new file mode 100644 index 000000000000..80930269bb8e --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes scheduling options. It describes restrictions used to + /// help Kubernetes select appropriate nodes to host the database service + /// + public partial class K8sSchedulingOptions + { + /// + /// Initializes a new instance of the K8sSchedulingOptions class. + /// + public K8sSchedulingOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the K8sSchedulingOptions class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + public K8sSchedulingOptions(IDictionary additionalProperties = default(IDictionary), K8sResourceRequirements resources = default(K8sResourceRequirements)) + { + AdditionalProperties = additionalProperties; + Resources = resources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "resources")] + public K8sResourceRequirements Resources { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs new file mode 100644 index 000000000000..1ec7ae9997d8 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Log analytics workspace id and primary key + /// + public partial class LogAnalyticsWorkspaceConfig + { + /// + /// Initializes a new instance of the LogAnalyticsWorkspaceConfig + /// class. + /// + public LogAnalyticsWorkspaceConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsWorkspaceConfig + /// class. + /// + /// Azure Log Analytics workspace ID + /// Primary key of the workspace + public LogAnalyticsWorkspaceConfig(System.Guid? workspaceId = default(System.Guid?), string primaryKey = default(string)) + { + WorkspaceId = workspaceId; + PrimaryKey = primaryKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure Log Analytics workspace ID + /// + [JsonProperty(PropertyName = "workspaceId")] + public System.Guid? WorkspaceId { get; set; } + + /// + /// Gets or sets primary key of the workspace + /// + [JsonProperty(PropertyName = "primaryKey")] + public string PrimaryKey { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ODataError.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ODataError.cs new file mode 100644 index 000000000000..409e4d5aee04 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ODataError.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information about an error. + /// + public partial class ODataError + { + /// + /// Initializes a new instance of the ODataError class. + /// + public ODataError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ODataError class. + /// + /// A language-independent error name. + /// The error message. + /// The target of the error (for example, the name + /// of the property in error). + /// The error details. + public ODataError(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a language-independent error name. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the target of the error (for example, the name of the + /// property in error). + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs new file mode 100644 index 000000000000..f9b283b45992 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties from the Kubernetes data controller + /// + public partial class OnPremiseProperty + { + /// + /// Initializes a new instance of the OnPremiseProperty class. + /// + public OnPremiseProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnPremiseProperty class. + /// + /// A globally unique ID identifying the associated + /// Kubernetes cluster + /// Certificate that contains the + /// Kubernetes cluster public key used to verify signing + /// Unique thumbprint + /// returned to customer to verify the certificate being + /// uploaded + public OnPremiseProperty(System.Guid id, string publicSigningKey, string signingCertificateThumbprint = default(string)) + { + Id = id; + PublicSigningKey = publicSigningKey; + SigningCertificateThumbprint = signingCertificateThumbprint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a globally unique ID identifying the associated + /// Kubernetes cluster + /// + [JsonProperty(PropertyName = "id")] + public System.Guid Id { get; set; } + + /// + /// Gets or sets certificate that contains the Kubernetes cluster + /// public key used to verify signing + /// + [JsonProperty(PropertyName = "publicSigningKey")] + public string PublicSigningKey { get; set; } + + /// + /// Gets or sets unique thumbprint returned to customer to verify the + /// certificate being uploaded + /// + [JsonProperty(PropertyName = "signingCertificateThumbprint")] + public string SigningCertificateThumbprint { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..65a82ecc0f02 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Azure Data Services on Azure Arc operation definition. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// The name of the operation being performed on + /// this particular object. + /// The localized display information for this + /// particular operation / action. + /// Indicates whether the operation is a + /// data action + /// The intended executor of the operation. + /// Possible values include: 'user', 'system' + /// Additional descriptions for the + /// operation. + public Operation(string name, OperationDisplay display, bool isDataAction, string origin = default(string), IDictionary properties = default(IDictionary)) + { + Name = name; + Display = display; + Origin = origin; + IsDataAction = isDataAction; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the operation being performed on this + /// particular object. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the localized display information for this particular + /// operation / action. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets the intended executor of the operation. Possible values + /// include: 'user', 'system' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool IsDataAction { get; set; } + + /// + /// Gets additional descriptions for the operation. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; private set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..9fc055c7362c --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Display metadata associated with the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// The localized friendly form of the resource + /// provider name. + /// The localized friendly form of the resource + /// type related to this action/operation. + /// The localized friendly name for the + /// operation. + /// The localized friendly description for + /// the operation. + public OperationDisplay(string provider, string resource, string operation, string description) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the localized friendly form of the resource provider + /// name. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets the localized friendly form of the resource type + /// related to this action/operation. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets the localized friendly name for the operation. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets the localized friendly description for the operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs new file mode 100644 index 000000000000..80b0feed0476 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.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.AzureArcData.Models +{ + + /// + /// Defines values for OperationOrigin. + /// + public static class OperationOrigin + { + public const string User = "user"; + public const string System = "system"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..27c055e3441f --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Plan.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Plan.cs new file mode 100644 index 000000000000..5687705819ae --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Plan.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Plan for the resource. + /// + public partial class Plan + { + /// + /// Initializes a new instance of the Plan class. + /// + public Plan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Plan class. + /// + /// A user defined name of the 3rd Party Artifact + /// that is being procured. + /// The publisher of the 3rd Party Artifact + /// that is being bought. E.g. NewRelic + /// The 3rd Party artifact that is being + /// procured. E.g. NewRelic. Product maps to the OfferID specified for + /// the artifact at the time of Data Market onboarding. + /// A publisher provided promotion code as + /// provisioned in Data Market for the said product/artifact. + /// The version of the desired + /// product/artifact. + public Plan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a user defined name of the 3rd Party Artifact that is + /// being procured. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher of the 3rd Party Artifact that is being + /// bought. E.g. NewRelic + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the 3rd Party artifact that is being procured. E.g. + /// NewRelic. Product maps to the OfferID specified for the artifact at + /// the time of Data Market onboarding. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets a publisher provided promotion code as provisioned in + /// Data Market for the said product/artifact. + /// + [JsonProperty(PropertyName = "promotionCode")] + public string PromotionCode { get; set; } + + /// + /// Gets or sets the version of the desired product/artifact. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..3cc9182aa417 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.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.AzureArcData.Models +{ + using System.Linq; + + /// + /// The resource model definition for a ARM proxy resource. It will have + /// everything other than required location and tags + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..9412cc38b866 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceIdentityType.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..80c1a2de0c1f --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + } + return null; + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceSku.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceSku.cs new file mode 100644 index 000000000000..98447ecc9a61 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceSku.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ResourceSku + { + /// + /// Initializes a new instance of the ResourceSku class. + /// + public ResourceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSku class. + /// + public ResourceSku(int? capacity = default(int?), string family = default(string), string name = default(string), string size = default(string), string tier = default(string)) + { + Capacity = capacity; + Family = family; + Name = name; + Size = size; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs new file mode 100644 index 000000000000..dd379bbacda6 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A SqlManagedInstance. + /// + public partial class SqlManagedInstance : TrackedResource + { + /// + /// Initializes a new instance of the SqlManagedInstance class. + /// + public SqlManagedInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstance class. + /// + /// The geo-location where the resource + /// lives + /// null + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// The extendedLocation of the + /// resource. + /// Resource sku. + public SqlManagedInstance(string location, SqlManagedInstanceProperties properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), ExtendedLocation extendedLocation = default(ExtendedLocation), SqlManagedInstanceSku sku = default(SqlManagedInstanceSku)) + : base(location, id, name, type, tags, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "properties")] + public SqlManagedInstanceProperties Properties { get; set; } + + /// + /// Gets or sets the extendedLocation of the resource. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets or sets resource sku. + /// + [JsonProperty(PropertyName = "sku")] + public SqlManagedInstanceSku Sku { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs new file mode 100644 index 000000000000..9bdcc2beecb8 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The raw kubernetes information. + /// + public partial class SqlManagedInstanceK8sRaw + { + /// + /// Initializes a new instance of the SqlManagedInstanceK8sRaw class. + /// + public SqlManagedInstanceK8sRaw() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceK8sRaw class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + public SqlManagedInstanceK8sRaw(IDictionary additionalProperties = default(IDictionary), SqlManagedInstanceK8sSpec spec = default(SqlManagedInstanceK8sSpec)) + { + AdditionalProperties = additionalProperties; + Spec = spec; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "spec")] + public SqlManagedInstanceK8sSpec Spec { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs new file mode 100644 index 000000000000..b7103ec9260c --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes spec information. + /// + public partial class SqlManagedInstanceK8sSpec + { + /// + /// Initializes a new instance of the SqlManagedInstanceK8sSpec class. + /// + public SqlManagedInstanceK8sSpec() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceK8sSpec class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// This option specifies the number of SQL + /// Managed Instance replicas that will be deployed in your Kubernetes + /// cluster for high availability purposes. If sku.tier is + /// BusinessCritical, allowed values are '2' or '3' with default of + /// '3'. If sku.tier is GeneralPurpose, replicas must be '1'. + public SqlManagedInstanceK8sSpec(IDictionary additionalProperties = default(IDictionary), K8sScheduling scheduling = default(K8sScheduling), int? replicas = default(int?)) + { + AdditionalProperties = additionalProperties; + Scheduling = scheduling; + Replicas = replicas; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "scheduling")] + public K8sScheduling Scheduling { get; set; } + + /// + /// Gets or sets this option specifies the number of SQL Managed + /// Instance replicas that will be deployed in your Kubernetes cluster + /// for high availability purposes. If sku.tier is BusinessCritical, + /// allowed values are '2' or '3' with default of '3'. If sku.tier is + /// GeneralPurpose, replicas must be '1'. + /// + [JsonProperty(PropertyName = "replicas")] + public int? Replicas { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs new file mode 100644 index 000000000000..3e46ee4c6573 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of sqlManagedInstance. + /// + public partial class SqlManagedInstanceProperties + { + /// + /// Initializes a new instance of the SqlManagedInstanceProperties + /// class. + /// + public SqlManagedInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceProperties + /// class. + /// + /// null + /// The instance admin user + /// The instance start time + /// The instance end time + /// The raw kubernetes information + /// Username and password for basic + /// authentication. + /// Last uploaded date from Kubernetes + /// cluster. Defaults to current date time + /// The license type to apply for this + /// managed instance. Possible values include: 'BasePrice', + /// 'LicenseIncluded' + /// If a CustomLocation is provided, this + /// contains the ARM id of the connected cluster the custom location + /// belongs to. + /// If a CustomLocation is provided, this + /// contains the ARM id of the extension the custom location belongs + /// to. + public SqlManagedInstanceProperties(string dataControllerId = default(string), string admin = default(string), string startTime = default(string), string endTime = default(string), SqlManagedInstanceK8sRaw k8sRaw = default(SqlManagedInstanceK8sRaw), BasicLoginInformation basicLoginInformation = default(BasicLoginInformation), System.DateTime? lastUploadedDate = default(System.DateTime?), string provisioningState = default(string), ArcSqlManagedInstanceLicenseType? licenseType = default(ArcSqlManagedInstanceLicenseType?), string clusterId = default(string), string extensionId = default(string)) + { + DataControllerId = dataControllerId; + Admin = admin; + StartTime = startTime; + EndTime = endTime; + K8sRaw = k8sRaw; + BasicLoginInformation = basicLoginInformation; + LastUploadedDate = lastUploadedDate; + ProvisioningState = provisioningState; + LicenseType = licenseType; + ClusterId = clusterId; + ExtensionId = extensionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "dataControllerId")] + public string DataControllerId { get; set; } + + /// + /// Gets or sets the instance admin user + /// + [JsonProperty(PropertyName = "admin")] + public string Admin { get; set; } + + /// + /// Gets or sets the instance start time + /// + [JsonProperty(PropertyName = "startTime")] + public string StartTime { get; set; } + + /// + /// Gets or sets the instance end time + /// + [JsonProperty(PropertyName = "endTime")] + public string EndTime { get; set; } + + /// + /// Gets or sets the raw kubernetes information + /// + [JsonProperty(PropertyName = "k8sRaw")] + public SqlManagedInstanceK8sRaw K8sRaw { get; set; } + + /// + /// Gets or sets username and password for basic authentication. + /// + [JsonProperty(PropertyName = "basicLoginInformation")] + public BasicLoginInformation BasicLoginInformation { get; set; } + + /// + /// Gets or sets last uploaded date from Kubernetes cluster. Defaults + /// to current date time + /// + [JsonProperty(PropertyName = "lastUploadedDate")] + public System.DateTime? LastUploadedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the license type to apply for this managed instance. + /// Possible values include: 'BasePrice', 'LicenseIncluded' + /// + [JsonProperty(PropertyName = "licenseType")] + public ArcSqlManagedInstanceLicenseType? LicenseType { get; set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the connected cluster the custom location belongs to. + /// + [JsonProperty(PropertyName = "clusterId")] + public string ClusterId { get; set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the extension the custom location belongs to. + /// + [JsonProperty(PropertyName = "extensionId")] + public string ExtensionId { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs new file mode 100644 index 000000000000..35976c781ef1 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition representing SKU for Azure Managed + /// Instance - Azure Arc + /// + public partial class SqlManagedInstanceSku + { + /// + /// Initializes a new instance of the SqlManagedInstanceSku class. + /// + public SqlManagedInstanceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceSku class. + /// + /// The pricing tier for the instance. Possible + /// values include: 'GeneralPurpose', 'BusinessCritical' + /// Whether dev/test is enabled. When the dev field + /// is set to true, the resource is used for dev/test purpose. + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + public SqlManagedInstanceSku(SqlManagedInstanceSkuTier? tier = default(SqlManagedInstanceSkuTier?), bool? dev = default(bool?), string size = default(string), string family = default(string), int? capacity = default(int?)) + { + Tier = tier; + Dev = dev; + Size = size; + Family = family; + Capacity = capacity; + CustomInit(); + } + /// + /// Static constructor for SqlManagedInstanceSku class. + /// + static SqlManagedInstanceSku() + { + Name = "vCore"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the pricing tier for the instance. Possible values + /// include: 'GeneralPurpose', 'BusinessCritical' + /// + [JsonProperty(PropertyName = "tier")] + public SqlManagedInstanceSkuTier? Tier { get; set; } + + /// + /// Gets or sets whether dev/test is enabled. When the dev field is set + /// to true, the resource is used for dev/test purpose. + /// + [JsonProperty(PropertyName = "dev")] + public bool? Dev { get; set; } + + /// + /// Gets or sets the SKU size. When the name field is the combination + /// of tier and some other value, this would be the standalone code. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// The name of the SKU. + /// + [JsonProperty(PropertyName = "name")] + public static string Name { get; private set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs new file mode 100644 index 000000000000..1a840475e662 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SqlManagedInstanceSkuTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SqlManagedInstanceSkuTier + { + [EnumMember(Value = "GeneralPurpose")] + GeneralPurpose, + [EnumMember(Value = "BusinessCritical")] + BusinessCritical + } + internal static class SqlManagedInstanceSkuTierEnumExtension + { + internal static string ToSerializedValue(this SqlManagedInstanceSkuTier? value) + { + return value == null ? null : ((SqlManagedInstanceSkuTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SqlManagedInstanceSkuTier value) + { + switch( value ) + { + case SqlManagedInstanceSkuTier.GeneralPurpose: + return "GeneralPurpose"; + case SqlManagedInstanceSkuTier.BusinessCritical: + return "BusinessCritical"; + } + return null; + } + + internal static SqlManagedInstanceSkuTier? ParseSqlManagedInstanceSkuTier(this string value) + { + switch( value ) + { + case "GeneralPurpose": + return SqlManagedInstanceSkuTier.GeneralPurpose; + case "BusinessCritical": + return SqlManagedInstanceSkuTier.BusinessCritical; + } + return null; + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs new file mode 100644 index 000000000000..381adf9bf5ab --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An update to a SQL Managed Instance. + /// + public partial class SqlManagedInstanceUpdate + { + /// + /// Initializes a new instance of the SqlManagedInstanceUpdate class. + /// + public SqlManagedInstanceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceUpdate class. + /// + /// Resource tags. + public SqlManagedInstanceUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs new file mode 100644 index 000000000000..b44e9a9eb0eb --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A SqlServerInstance. + /// + public partial class SqlServerInstance : TrackedResource + { + /// + /// Initializes a new instance of the SqlServerInstance class. + /// + public SqlServerInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerInstance class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// null + public SqlServerInstance(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), SqlServerInstanceProperties properties = default(SqlServerInstanceProperties)) + : base(location, id, name, type, tags, systemData) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "properties")] + public SqlServerInstanceProperties Properties { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs new file mode 100644 index 000000000000..743adc614268 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs @@ -0,0 +1,200 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of SqlServerInstance. + /// + public partial class SqlServerInstanceProperties + { + /// + /// Initializes a new instance of the SqlServerInstanceProperties + /// class. + /// + public SqlServerInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerInstanceProperties + /// class. + /// + /// ARM Resource id of the container + /// resource (Azure Arc for Servers). + /// The cloud connectivity status. Possible values + /// include: 'Connected', 'Disconnected', 'Unknown' + /// SQL Server version. Possible values include: + /// 'SQL Server 2019', 'SQL Server 2017', 'SQL Server 2016' + /// SQL Server edition. Possible values include: + /// 'Evaluation', 'Enterprise', 'Standard', 'Web', 'Developer', + /// 'Express' + /// The time when the resource was + /// created. + /// The number of logical processors used by the + /// SQL Server instance. + /// SQL Server update level. + /// SQL Server collation. + /// SQL Server current version. + /// SQL Server instance name. + /// Dynamic TCP ports used by SQL + /// Server. + /// Static TCP ports used by SQL + /// Server. + /// SQL Server product ID. + /// SQL Server license type. Possible values + /// include: 'Paid', 'Free', 'HADR', 'Undefined' + /// Timestamp of last + /// Azure Defender status update. + /// Status of Azure Defender. + /// Possible values include: 'Protected', 'Unprotected', + /// 'Unknown' + public SqlServerInstanceProperties(string containerResourceId, string status, string version = default(string), string edition = default(string), string createTime = default(string), string vCore = default(string), string patchLevel = default(string), string collation = default(string), string currentVersion = default(string), string instanceName = default(string), string tcpDynamicPorts = default(string), string tcpStaticPorts = default(string), string productId = default(string), string licenseType = default(string), System.DateTime? azureDefenderStatusLastUpdated = default(System.DateTime?), string azureDefenderStatus = default(string), string provisioningState = default(string)) + { + Version = version; + Edition = edition; + ContainerResourceId = containerResourceId; + CreateTime = createTime; + VCore = vCore; + Status = status; + PatchLevel = patchLevel; + Collation = collation; + CurrentVersion = currentVersion; + InstanceName = instanceName; + TcpDynamicPorts = tcpDynamicPorts; + TcpStaticPorts = tcpStaticPorts; + ProductId = productId; + LicenseType = licenseType; + AzureDefenderStatusLastUpdated = azureDefenderStatusLastUpdated; + AzureDefenderStatus = azureDefenderStatus; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SQL Server version. Possible values include: 'SQL + /// Server 2019', 'SQL Server 2017', 'SQL Server 2016' + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets SQL Server edition. Possible values include: + /// 'Evaluation', 'Enterprise', 'Standard', 'Web', 'Developer', + /// 'Express' + /// + [JsonProperty(PropertyName = "edition")] + public string Edition { get; set; } + + /// + /// Gets or sets ARM Resource id of the container resource (Azure Arc + /// for Servers). + /// + [JsonProperty(PropertyName = "containerResourceId")] + public string ContainerResourceId { get; set; } + + /// + /// Gets the time when the resource was created. + /// + [JsonProperty(PropertyName = "createTime")] + public string CreateTime { get; private set; } + + /// + /// Gets or sets the number of logical processors used by the SQL + /// Server instance. + /// + [JsonProperty(PropertyName = "vCore")] + public string VCore { get; set; } + + /// + /// Gets or sets the cloud connectivity status. Possible values + /// include: 'Connected', 'Disconnected', 'Unknown' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets SQL Server update level. + /// + [JsonProperty(PropertyName = "patchLevel")] + public string PatchLevel { get; set; } + + /// + /// Gets or sets SQL Server collation. + /// + [JsonProperty(PropertyName = "collation")] + public string Collation { get; set; } + + /// + /// Gets or sets SQL Server current version. + /// + [JsonProperty(PropertyName = "currentVersion")] + public string CurrentVersion { get; set; } + + /// + /// Gets or sets SQL Server instance name. + /// + [JsonProperty(PropertyName = "instanceName")] + public string InstanceName { get; set; } + + /// + /// Gets or sets dynamic TCP ports used by SQL Server. + /// + [JsonProperty(PropertyName = "tcpDynamicPorts")] + public string TcpDynamicPorts { get; set; } + + /// + /// Gets or sets static TCP ports used by SQL Server. + /// + [JsonProperty(PropertyName = "tcpStaticPorts")] + public string TcpStaticPorts { get; set; } + + /// + /// Gets or sets SQL Server product ID. + /// + [JsonProperty(PropertyName = "productId")] + public string ProductId { get; set; } + + /// + /// Gets or sets SQL Server license type. Possible values include: + /// 'Paid', 'Free', 'HADR', 'Undefined' + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets or sets timestamp of last Azure Defender status update. + /// + [JsonProperty(PropertyName = "azureDefenderStatusLastUpdated")] + public System.DateTime? AzureDefenderStatusLastUpdated { get; set; } + + /// + /// Gets or sets status of Azure Defender. Possible values include: + /// 'Protected', 'Unprotected', 'Unknown' + /// + [JsonProperty(PropertyName = "azureDefenderStatus")] + public string AzureDefenderStatus { get; set; } + + /// + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs new file mode 100644 index 000000000000..572595006a85 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An update to a SQL Server Instance. + /// + public partial class SqlServerInstanceUpdate + { + /// + /// Initializes a new instance of the SqlServerInstanceUpdate class. + /// + public SqlServerInstanceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerInstanceUpdate class. + /// + /// Resource tags. + public SqlServerInstanceUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs new file mode 100644 index 000000000000..2c15cb0a1b94 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.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.AzureArcData.Models +{ + + /// + /// Defines values for SqlVersion. + /// + public static class SqlVersion + { + public const string SQLServer2019 = "SQL Server 2019"; + public const string SQLServer2017 = "SQL Server 2017"; + public const string SQLServer2016 = "SQL Server 2016"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..6a1164b2e3a0 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Read only system data + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// An identifier for the identity that created + /// the resource + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC) + /// An identifier for the identity that + /// last modified the resource + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an identifier for the identity that created the + /// resource + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC) + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets an identifier for the identity that last modified the + /// resource + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..4494ea4b122a --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for a ARM tracked top level resource + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Tags = tags; + Location = location; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs new file mode 100644 index 000000000000..d3a83c877158 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service principal for uploading billing, metrics and logs. + /// + public partial class UploadServicePrincipal + { + /// + /// Initializes a new instance of the UploadServicePrincipal class. + /// + public UploadServicePrincipal() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UploadServicePrincipal class. + /// + /// Client ID of the service principal for + /// uploading data. + /// Tenant ID of the service principal. + /// Authority for the service principal. + /// Example: https://login.microsoftonline.com/ + /// Secret of the service principal + public UploadServicePrincipal(System.Guid? clientId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), string authority = default(string), string clientSecret = default(string)) + { + ClientId = clientId; + TenantId = tenantId; + Authority = authority; + ClientSecret = clientSecret; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets client ID of the service principal for uploading data. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; set; } + + /// + /// Gets or sets tenant ID of the service principal. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; set; } + + /// + /// Gets or sets authority for the service principal. Example: + /// https://login.microsoftonline.com/ + /// + [JsonProperty(PropertyName = "authority")] + public string Authority { get; set; } + + /// + /// Gets or sets secret of the service principal + /// + [JsonProperty(PropertyName = "clientSecret")] + public string ClientSecret { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs new file mode 100644 index 000000000000..f7914d132434 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties on upload watermark. Mostly timestamp for each upload data + /// type + /// + public partial class UploadWatermark + { + /// + /// Initializes a new instance of the UploadWatermark class. + /// + public UploadWatermark() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UploadWatermark class. + /// + /// Last uploaded date for metrics from + /// kubernetes cluster. Defaults to current date time + /// Last uploaded date for logs from kubernetes + /// cluster. Defaults to current date time + /// Last uploaded date for usages from kubernetes + /// cluster. Defaults to current date time + public UploadWatermark(System.DateTime? metrics = default(System.DateTime?), System.DateTime? logs = default(System.DateTime?), System.DateTime? usages = default(System.DateTime?)) + { + Metrics = metrics; + Logs = logs; + Usages = usages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets last uploaded date for metrics from kubernetes + /// cluster. Defaults to current date time + /// + [JsonProperty(PropertyName = "metrics")] + public System.DateTime? Metrics { get; set; } + + /// + /// Gets or sets last uploaded date for logs from kubernetes cluster. + /// Defaults to current date time + /// + [JsonProperty(PropertyName = "logs")] + public System.DateTime? Logs { get; set; } + + /// + /// Gets or sets last uploaded date for usages from kubernetes cluster. + /// Defaults to current date time + /// + [JsonProperty(PropertyName = "usages")] + public System.DateTime? Usages { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs new file mode 100644 index 000000000000..b693a95ac230 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs @@ -0,0 +1,390 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.AzureArcData/operations").ToString(); + 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("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 of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// 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/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..9c52846cf2d8 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// 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 IOperations 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/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs new file mode 100644 index 000000000000..6a9575fbf42c --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs @@ -0,0 +1,30 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AzureArcDataManagementClient + { + get + { + return new Tuple[] + { + new Tuple("AzureArcData", "DataControllers", "2021-08-01"), + new Tuple("AzureArcData", "Operations", "2021-08-01"), + new Tuple("AzureArcData", "SqlManagedInstances", "2021-08-01"), + new Tuple("AzureArcData", "SqlServerInstances", "2021-08-01"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs new file mode 100644 index 000000000000..eaae2ae27787 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs @@ -0,0 +1,1588 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + 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; + + /// + /// SqlManagedInstancesOperations operations. + /// + internal partial class SqlManagedInstancesOperations : IServiceOperations, ISqlManagedInstancesOperations + { + /// + /// Initializes a new instance of the SqlManagedInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SqlManagedInstancesOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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.AzureArcData/sqlManagedInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("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; + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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("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; + } + + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + 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("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 or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlManagedInstance + /// + /// + /// Resource tags. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + SqlManagedInstanceUpdate parameters = new SqlManagedInstanceUpdate(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (sqlManagedInstance == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstance"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + tracingParameters.Add("sqlManagedInstance", sqlManagedInstance); + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + 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("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sqlManagedInstance != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlManagedInstance, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + 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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..b5ece6b7bb49 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs @@ -0,0 +1,421 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlManagedInstancesOperations. + /// + public static partial class SqlManagedInstancesOperationsExtensions + { + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISqlManagedInstancesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISqlManagedInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListByResourceGroup(this ISqlManagedInstancesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + public static SqlManagedInstance Get(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName) + { + return operations.GetAsync(resourceGroupName, sqlManagedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + public static SqlManagedInstance Create(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance) + { + return operations.CreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + public static void Delete(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName) + { + operations.DeleteAsync(resourceGroupName, sqlManagedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlManagedInstance + /// + /// + /// Resource tags. + /// + public static SqlManagedInstance Update(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, sqlManagedInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlManagedInstance + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + public static SqlManagedInstance BeginCreate(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance) + { + return operations.BeginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Managed Instances + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + public static void BeginDelete(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName) + { + operations.BeginDeleteAsync(resourceGroupName, sqlManagedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of Sql Managed Instances + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISqlManagedInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISqlManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISqlManagedInstancesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISqlManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs new file mode 100644 index 000000000000..c58b7ee630c3 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs @@ -0,0 +1,1588 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + 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; + + /// + /// SqlServerInstancesOperations operations. + /// + internal partial class SqlServerInstancesOperations : IServiceOperations, ISqlServerInstancesOperations + { + /// + /// Initializes a new instance of the SqlServerInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SqlServerInstancesOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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.AzureArcData/sqlServerInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("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; + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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("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; + } + + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + 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("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 or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlServerInstance + /// + /// + /// Resource tags. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + SqlServerInstanceUpdate parameters = new SqlServerInstanceUpdate(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (sqlServerInstance == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstance"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + tracingParameters.Add("sqlServerInstance", sqlServerInstance); + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + 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("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sqlServerInstance != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlServerInstance, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + 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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..57baa150afd0 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs @@ -0,0 +1,421 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlServerInstancesOperations. + /// + public static partial class SqlServerInstancesOperationsExtensions + { + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISqlServerInstancesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISqlServerInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListByResourceGroup(this ISqlServerInstancesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + public static SqlServerInstance Get(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName) + { + return operations.GetAsync(resourceGroupName, sqlServerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + public static SqlServerInstance Create(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance) + { + return operations.CreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + public static void Delete(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName) + { + operations.DeleteAsync(resourceGroupName, sqlServerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlServerInstance + /// + /// + /// Resource tags. + /// + public static SqlServerInstance Update(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, sqlServerInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of sqlServerInstance + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + public static SqlServerInstance BeginCreate(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance) + { + return operations.BeginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + public static void BeginDelete(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName) + { + operations.BeginDeleteAsync(resourceGroupName, sqlServerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of SQL Server Instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISqlServerInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISqlServerInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISqlServerInstancesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISqlServerInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}