From 29f60786b5a80fb72dd6ad331663b5bad94fdca3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 23 Feb 2023 03:17:34 +0000 Subject: [PATCH] CodeGen from PR 22493 in Azure/azure-rest-api-specs Merge 7ea489e265a3e153d2c9e68aa97f2f3b9b81fee2 into 80d422bdf9d305b5403c1540fffbcb981269791e --- .../ActiveDirectoryConnectorsOperations.cs | 1084 +++++++++++ ...DirectoryConnectorsOperationsExtensions.cs | 339 ++++ .../Generated/AzureArcDataManagementClient.cs | 401 ++++ .../Generated/DataControllersOperations.cs | 1606 +++++++++++++++++ .../DataControllersOperationsExtensions.cs | 453 +++++ .../src/Generated/FailoverGroupsOperations.cs | 1082 +++++++++++ .../FailoverGroupsOperationsExtensions.cs | 335 ++++ .../IActiveDirectoryConnectorsOperations.cs | 216 +++ .../IAzureArcDataManagementClient.cs | 114 ++ .../Generated/IDataControllersOperations.cs | 293 +++ .../Generated/IFailoverGroupsOperations.cs | 216 +++ .../src/Generated/IOperations.cs | 70 + .../Generated/IPostgresInstancesOperations.cs | 271 +++ .../ISqlManagedInstancesOperations.cs | 271 +++ .../ISqlServerDatabasesOperations.cs | 189 ++ .../ISqlServerInstancesOperations.cs | 271 +++ .../src/Generated/Models/AGReplicas.cs | 104 ++ .../Models/AccountProvisioningMode.cs | 22 + .../ActiveDirectoryConnectorDNSDetails.cs | 87 + .../ActiveDirectoryConnectorDomainDetails.cs | 93 + .../ActiveDirectoryConnectorProperties.cs | 81 + .../ActiveDirectoryConnectorResource.cs | 62 + .../Models/ActiveDirectoryConnectorSpec.cs | 61 + .../Models/ActiveDirectoryConnectorStatus.cs | 85 + .../Models/ActiveDirectoryDomainController.cs | 55 + .../ActiveDirectoryDomainControllers.cs | 66 + .../Models/ActiveDirectoryInformation.cs | 54 + .../ArcSqlManagedInstanceLicenseType.cs | 23 + .../Models/ArcSqlServerLicenseType.cs | 27 + .../Generated/Models/AzureEntityResource.cs | 64 + .../Generated/Models/BasicLoginInformation.cs | 59 + .../src/Generated/Models/CommonSku.cs | 96 + .../src/Generated/Models/ConnectionStatus.cs | 24 + .../src/Generated/Models/CreatedByType.cs | 24 + .../Models/DataControllerProperties.cs | 165 ++ .../Models/DataControllerResource.cs | 74 + .../Generated/Models/DataControllerUpdate.cs | 61 + .../src/Generated/Models/DatabaseState.cs | 29 + .../src/Generated/Models/DefenderStatus.cs | 23 + .../src/Generated/Models/EditionType.cs | 27 + .../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 + .../Models/FailoverGroupPartnerSyncMode.cs | 22 + .../Models/FailoverGroupProperties.cs | 82 + .../Generated/Models/FailoverGroupResource.cs | 60 + .../src/Generated/Models/FailoverGroupSpec.cs | 129 ++ .../Generated/Models/FailoverGroupStatus.cs | 115 ++ .../src/Generated/Models/HostType.cs | 33 + .../src/Generated/Models/Identity.cs | 70 + .../src/Generated/Models/Infrastructure.cs | 84 + .../Models/InstanceFailoverGroupRole.cs | 24 + .../Models/K8sResourceRequirements.cs | 88 + .../src/Generated/Models/K8sScheduling.cs | 61 + .../Generated/Models/K8sSchedulingOptions.cs | 62 + .../src/Generated/Models/KeytabInformation.cs | 51 + .../Models/LogAnalyticsWorkspaceConfig.cs | 61 + .../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/PostgresInstance.cs | 82 + .../Models/PostgresInstanceProperties.cs | 96 + .../Generated/Models/PostgresInstanceSku.cs | 69 + .../Models/PostgresInstanceSkuTier.cs | 54 + .../Models/PostgresInstanceUpdate.cs | 59 + .../src/Generated/Models/ProvisioningState.cs | 24 + .../src/Generated/Models/ProxyResource.cs | 55 + .../src/Generated/Models/RecoveryMode.cs | 23 + .../src/Generated/Models/Resource.cs | 89 + .../Generated/Models/ResourceIdentityType.cs | 54 + .../ResourceModelWithAllowedPropertySet.cs | 117 ++ ...urceModelWithAllowedPropertySetIdentity.cs | 47 + ...ResourceModelWithAllowedPropertySetPlan.cs | 53 + .../ResourceModelWithAllowedPropertySetSku.cs | 54 + .../src/Generated/Models/Sku.cs | 96 + .../src/Generated/Models/SkuTier.cs | 72 + .../Generated/Models/SqlManagedInstance.cs | 82 + .../Models/SqlManagedInstanceK8sRaw.cs | 61 + .../Models/SqlManagedInstanceK8sSpec.cs | 77 + .../Models/SqlManagedInstanceProperties.cs | 158 ++ .../Generated/Models/SqlManagedInstanceSku.cs | 104 ++ .../Models/SqlManagedInstanceSkuTier.cs | 60 + .../Models/SqlManagedInstanceUpdate.cs | 53 + .../Models/SqlServerDatabaseResource.cs | 66 + .../SqlServerDatabaseResourceProperties.cs | 143 ++ ...baseResourcePropertiesBackupInformation.cs | 58 + ...tabaseResourcePropertiesDatabaseOptions.cs | 93 + .../Models/SqlServerDatabaseUpdate.cs | 61 + .../src/Generated/Models/SqlServerInstance.cs | 65 + .../Models/SqlServerInstanceProperties.cs | 238 +++ .../Models/SqlServerInstanceUpdate.cs | 53 + .../src/Generated/Models/SqlVersion.cs | 27 + .../src/Generated/Models/State.cs | 23 + .../src/Generated/Models/SystemData.cs | 103 ++ .../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 + .../Generated/PostgresInstancesOperations.cs | 1587 ++++++++++++++++ .../PostgresInstancesOperationsExtensions.cs | 419 +++++ .../SdkInfo_AzureArcDataManagementClient.cs | 34 + .../SqlManagedInstancesOperations.cs | 1588 ++++++++++++++++ ...SqlManagedInstancesOperationsExtensions.cs | 421 +++++ .../Generated/SqlServerDatabasesOperations.cs | 1220 +++++++++++++ .../SqlServerDatabasesOperationsExtensions.cs | 292 +++ .../Generated/SqlServerInstancesOperations.cs | 1588 ++++++++++++++++ .../SqlServerInstancesOperationsExtensions.cs | 421 +++++ 113 files changed, 21158 insertions(+) create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperationsExtensions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperationsExtensions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IActiveDirectoryConnectorsOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IFailoverGroupsOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IPostgresInstancesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerDatabasesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AGReplicas.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AccountProvisioningMode.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDNSDetails.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDomainDetails.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorProperties.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorResource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorSpec.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorStatus.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainController.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainControllers.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryInformation.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AzureEntityResource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DatabaseState.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupPartnerSyncMode.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupProperties.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupResource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupSpec.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupStatus.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/HostType.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Identity.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/InstanceFailoverGroupRole.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/KeytabInformation.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Plan.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstance.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceProperties.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSku.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSkuTier.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceUpdate.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/RecoveryMode.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceIdentityType.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Sku.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SkuTier.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourceProperties.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesBackupInformation.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesDatabaseOptions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseUpdate.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/State.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperationsExtensions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperationsExtensions.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs create mode 100644 sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperations.cs new file mode 100644 index 0000000000000..daa45565791c6 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperations.cs @@ -0,0 +1,1084 @@ +// +// 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; + + /// + /// ActiveDirectoryConnectorsOperations operations. + /// + internal partial class ActiveDirectoryConnectorsOperations : IServiceOperations, IActiveDirectoryConnectorsOperations + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ActiveDirectoryConnectorsOperations(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 the active directory connectors associated with the given data + /// controller. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string 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, "List", 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}/activeDirectoryConnectors").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; + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector 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 dataControllerName, string activeDirectoryConnectorName, 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 (activeDirectoryConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "activeDirectoryConnectorName"); + } + 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("activeDirectoryConnectorName", activeDirectoryConnectorName); + 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/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}").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)); + _url = _url.Replace("{activeDirectoryConnectorName}", System.Uri.EscapeDataString(activeDirectoryConnectorName)); + 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 an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// 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 dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, 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 (activeDirectoryConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "activeDirectoryConnectorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + ActiveDirectoryConnectorResource activeDirectoryConnectorResource = new ActiveDirectoryConnectorResource(); + if (properties != null) + { + activeDirectoryConnectorResource.Properties = properties; + } + // 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("activeDirectoryConnectorName", activeDirectoryConnectorName); + tracingParameters.Add("activeDirectoryConnectorResource", activeDirectoryConnectorResource); + 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/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}").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)); + _url = _url.Replace("{activeDirectoryConnectorName}", System.Uri.EscapeDataString(activeDirectoryConnectorName)); + 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(activeDirectoryConnectorResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activeDirectoryConnectorResource, 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 an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector 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 dataControllerName, string activeDirectoryConnectorName, 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 (activeDirectoryConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "activeDirectoryConnectorName"); + } + 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("activeDirectoryConnectorName", activeDirectoryConnectorName); + 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/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}").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)); + _url = _url.Replace("{activeDirectoryConnectorName}", System.Uri.EscapeDataString(activeDirectoryConnectorName)); + 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 the active directory connectors associated with the given data + /// controller. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperationsExtensions.cs new file mode 100644 index 0000000000000..9568d41ff7676 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// 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 ActiveDirectoryConnectorsOperations. + /// + public static partial class ActiveDirectoryConnectorsOperationsExtensions + { + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + public static IPage List(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName) + { + return operations.ListAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + public static ActiveDirectoryConnectorResource Create(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties) + { + return operations.CreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + public static void Delete(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName) + { + operations.DeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + public static ActiveDirectoryConnectorResource Get(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName) + { + return operations.GetAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + public static ActiveDirectoryConnectorResource BeginCreate(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties) + { + return operations.BeginCreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + public static void BeginDelete(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName) + { + operations.BeginDeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IActiveDirectoryConnectorsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// 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 IActiveDirectoryConnectorsOperations 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs new file mode 100644 index 0000000000000..02cfb79b5fa69 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs @@ -0,0 +1,401 @@ +// +// 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 IFailoverGroupsOperations. + /// + public virtual IFailoverGroupsOperations FailoverGroups { get; private set; } + + /// + /// Gets the ISqlServerInstancesOperations. + /// + public virtual ISqlServerInstancesOperations SqlServerInstances { get; private set; } + + /// + /// Gets the IDataControllersOperations. + /// + public virtual IDataControllersOperations DataControllers { get; private set; } + + /// + /// Gets the IActiveDirectoryConnectorsOperations. + /// + public virtual IActiveDirectoryConnectorsOperations ActiveDirectoryConnectors { get; private set; } + + /// + /// Gets the IPostgresInstancesOperations. + /// + public virtual IPostgresInstancesOperations PostgresInstances { get; private set; } + + /// + /// Gets the ISqlServerDatabasesOperations. + /// + public virtual ISqlServerDatabasesOperations SqlServerDatabases { 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); + FailoverGroups = new FailoverGroupsOperations(this); + SqlServerInstances = new SqlServerInstancesOperations(this); + DataControllers = new DataControllersOperations(this); + ActiveDirectoryConnectors = new ActiveDirectoryConnectorsOperations(this); + PostgresInstances = new PostgresInstancesOperations(this); + SqlServerDatabases = new SqlServerDatabasesOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2023-01-15-preview"; + 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs new file mode 100644 index 0000000000000..012562196161c --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs @@ -0,0 +1,1606 @@ +// +// 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 name of the data controller + /// + /// + /// 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 name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PatchDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPatchDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, dataControllerResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + /// + /// 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; + } + + /// + /// Updates a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// 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> BeginPatchDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, 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"); + } + if (dataControllerResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerResource"); + } + // 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, "BeginPatchDataController", 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 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 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 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs new file mode 100644 index 0000000000000..20a8a2d4cfc88 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs @@ -0,0 +1,453 @@ +// +// 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 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 + /// + /// + /// The name of the data controller + /// + 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 name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + 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 name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + 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 name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + public static DataControllerResource PatchDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource) + { + return operations.PatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).GetAwaiter().GetResult(); + } + + /// + /// Updates a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// The cancellation token. + /// + public static async Task PatchDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PatchDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, dataControllerResource, 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 + /// + /// + /// The name of the data controller + /// + 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 name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + 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 name of the data controller + /// + /// + /// 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(); + } + + /// + /// Updates a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + public static DataControllerResource BeginPatchDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource) + { + return operations.BeginPatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).GetAwaiter().GetResult(); + } + + /// + /// Updates a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// The cancellation token. + /// + public static async Task BeginPatchDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPatchDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, dataControllerResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperations.cs new file mode 100644 index 0000000000000..102055f5920fb --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperations.cs @@ -0,0 +1,1082 @@ +// +// 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; + + /// + /// FailoverGroupsOperations operations. + /// + internal partial class FailoverGroupsOperations : IServiceOperations, IFailoverGroupsOperations + { + /// + /// Initializes a new instance of the FailoverGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FailoverGroupsOperations(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 the failover groups associated with the given sql managed instance. + /// + /// + /// 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>> ListWithHttpMessagesAsync(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, "List", 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}/failoverGroups").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 failover group resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, FailoverGroupProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a failover group resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a failover group resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover 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> GetWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, 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 (failoverGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "failoverGroupName"); + } + 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("failoverGroupName", failoverGroupName); + 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}/failoverGroups/{failoverGroupName}").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)); + _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); + 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 failover group resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + /// + /// 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, string failoverGroupName, FailoverGroupProperties properties, 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 (failoverGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "failoverGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + FailoverGroupResource failoverGroupResource = new FailoverGroupResource(); + if (properties != null) + { + failoverGroupResource.Properties = properties; + } + // 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("failoverGroupName", failoverGroupName); + tracingParameters.Add("failoverGroupResource", failoverGroupResource); + 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}/failoverGroups/{failoverGroupName}").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)); + _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); + 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(failoverGroupResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(failoverGroupResource, 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 failover group resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, 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 (failoverGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "failoverGroupName"); + } + 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("failoverGroupName", failoverGroupName); + 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}/failoverGroups/{failoverGroupName}").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)); + _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); + 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 the failover groups associated with the given sql managed instance. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperationsExtensions.cs new file mode 100644 index 0000000000000..24ef124808467 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/FailoverGroupsOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// 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 FailoverGroupsOperations. + /// + public static partial class FailoverGroupsOperationsExtensions + { + /// + /// List the failover groups associated with the given sql managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + public static IPage List(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName) + { + return operations.ListAsync(resourceGroupName, sqlManagedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// List the failover groups associated with the given sql managed instance. + /// + /// + /// 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> ListAsync(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a failover group resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + public static FailoverGroupResource Create(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, FailoverGroupProperties properties) + { + return operations.CreateAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, properties).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a failover group resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, FailoverGroupProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a failover group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + public static void Delete(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName) + { + operations.DeleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a failover group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves a failover group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + public static FailoverGroupResource Get(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName) + { + return operations.GetAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a failover group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a failover group resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + public static FailoverGroupResource BeginCreate(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, FailoverGroupProperties properties) + { + return operations.BeginCreateAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, properties).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a failover group resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, FailoverGroupProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a failover group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + public static void BeginDelete(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName) + { + operations.BeginDeleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a failover group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFailoverGroupsOperations operations, string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List the failover groups associated with the given sql managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IFailoverGroupsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the failover groups associated with the given sql managed instance. + /// + /// + /// 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 IFailoverGroupsOperations 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IActiveDirectoryConnectorsOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IActiveDirectoryConnectorsOperations.cs new file mode 100644 index 0000000000000..0bd8d5c133ede --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IActiveDirectoryConnectorsOperations.cs @@ -0,0 +1,216 @@ +// +// 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; + + /// + /// ActiveDirectoryConnectorsOperations operations. + /// + public partial interface IActiveDirectoryConnectorsOperations + { + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// 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 dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector 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 dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector 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 dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// 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 dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector 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 dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs new file mode 100644 index 0000000000000..253a5713397a0 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs @@ -0,0 +1,114 @@ +// +// 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 IFailoverGroupsOperations. + /// + IFailoverGroupsOperations FailoverGroups { get; } + + /// + /// Gets the ISqlServerInstancesOperations. + /// + ISqlServerInstancesOperations SqlServerInstances { get; } + + /// + /// Gets the IDataControllersOperations. + /// + IDataControllersOperations DataControllers { get; } + + /// + /// Gets the IActiveDirectoryConnectorsOperations. + /// + IActiveDirectoryConnectorsOperations ActiveDirectoryConnectors { get; } + + /// + /// Gets the IPostgresInstancesOperations. + /// + IPostgresInstancesOperations PostgresInstances { get; } + + /// + /// Gets the ISqlServerDatabasesOperations. + /// + ISqlServerDatabasesOperations SqlServerDatabases { get; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs new file mode 100644 index 0000000000000..a4a14c25f6f79 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs @@ -0,0 +1,293 @@ +// +// 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 name of the data controller + /// + /// + /// 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 name of the data controller + /// + /// + /// 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 name of the data controller + /// + /// + /// 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 + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// 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, DataControllerUpdate dataControllerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// 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 name of the data controller + /// + /// + /// 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)); + /// + /// Updates a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// 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> BeginPatchDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IFailoverGroupsOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IFailoverGroupsOperations.cs new file mode 100644 index 0000000000000..b1ddba450989e --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IFailoverGroupsOperations.cs @@ -0,0 +1,216 @@ +// +// 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; + + /// + /// FailoverGroupsOperations operations. + /// + public partial interface IFailoverGroupsOperations + { + /// + /// List the failover groups associated with the given sql managed + /// instance. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a failover group resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + /// + /// 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, string failoverGroupName, FailoverGroupProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a failover group resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a failover group resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover 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> GetWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a failover group resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover Group + /// + /// + /// null + /// + /// + /// 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, string failoverGroupName, FailoverGroupProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a failover group resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The name of the Failover 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, string failoverGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the failover groups associated with the given sql managed + /// instance. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..5965cad855a94 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IPostgresInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IPostgresInstancesOperations.cs new file mode 100644 index 0000000000000..53fd7aaac0694 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IPostgresInstancesOperations.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; + + /// + /// PostgresInstancesOperations operations. + /// + public partial interface IPostgresInstancesOperations + { + /// + /// List postgres Instance 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 postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// 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 postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres 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 postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres 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> CreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres 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 postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres 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 postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List postgres Instance 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 postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs new file mode 100644 index 0000000000000..1ca37ec445851 --- /dev/null +++ b/sdk/azurearcdata/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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// 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 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 SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// 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 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerDatabasesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerDatabasesOperations.cs new file mode 100644 index 0000000000000..8c2b9ed0742e3 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerDatabasesOperations.cs @@ -0,0 +1,189 @@ +// +// 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; + + /// + /// SqlServerDatabasesOperations operations. + /// + public partial interface ISqlServerDatabasesOperations + { + /// + /// Creates or replaces an Arc Sql Server Database. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The request body for database resource. + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// 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, SqlServerDatabaseResource sqlServerDatabaseResource, string sqlServerInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Arc Sql Server database resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// 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, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves an Arc Sql Server database. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// 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, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing database. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// The requested database resource state. + /// + /// + /// 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, string databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs new file mode 100644 index 0000000000000..70c571588ee83 --- /dev/null +++ b/sdk/azurearcdata/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 + /// + /// + /// 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 + /// + /// + /// 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 SQL Server Instance + /// + /// + /// 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 + /// + /// + /// 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 + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AGReplicas.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AGReplicas.cs new file mode 100644 index 0000000000000..fbfb8afbe4bbe --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AGReplicas.cs @@ -0,0 +1,104 @@ +// +// 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 information about each failover group replica. + /// + public partial class AGReplicas + { + /// + /// Initializes a new instance of the AGReplicas class. + /// + public AGReplicas() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AGReplicas class. + /// + /// The health state of the replica. + /// The replica name. + /// The role of the replica. + /// The connected state of the + /// replica. + /// The synchronization state of the + /// availability group replicas. + /// The availability mode of the + /// replica. + /// The secondary role + /// allowed connections. + public AGReplicas(string healthState = default(string), string replicaName = default(string), string role = default(string), string connectedState = default(string), string synchronizationState = default(string), string availabilityMode = default(string), string secondaryRoleAllowConnections = default(string)) + { + HealthState = healthState; + ReplicaName = replicaName; + Role = role; + ConnectedState = connectedState; + SynchronizationState = synchronizationState; + AvailabilityMode = availabilityMode; + SecondaryRoleAllowConnections = secondaryRoleAllowConnections; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the health state of the replica. + /// + [JsonProperty(PropertyName = "healthState")] + public string HealthState { get; set; } + + /// + /// Gets or sets the replica name. + /// + [JsonProperty(PropertyName = "replicaName")] + public string ReplicaName { get; set; } + + /// + /// Gets or sets the role of the replica. + /// + [JsonProperty(PropertyName = "role")] + public string Role { get; set; } + + /// + /// Gets or sets the connected state of the replica. + /// + [JsonProperty(PropertyName = "connectedState")] + public string ConnectedState { get; set; } + + /// + /// Gets or sets the synchronization state of the availability group + /// replicas. + /// + [JsonProperty(PropertyName = "synchronizationState")] + public string SynchronizationState { get; set; } + + /// + /// Gets or sets the availability mode of the replica. + /// + [JsonProperty(PropertyName = "availabilityMode")] + public string AvailabilityMode { get; set; } + + /// + /// Gets or sets the secondary role allowed connections. + /// + [JsonProperty(PropertyName = "secondaryRoleAllowConnections")] + public string SecondaryRoleAllowConnections { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AccountProvisioningMode.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AccountProvisioningMode.cs new file mode 100644 index 0000000000000..295e21366d901 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AccountProvisioningMode.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 AccountProvisioningMode. + /// + public static class AccountProvisioningMode + { + public const string Automatic = "automatic"; + public const string Manual = "manual"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDNSDetails.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDNSDetails.cs new file mode 100644 index 0000000000000..97c6cf5fdaa9a --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDNSDetails.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// DNS server details + /// + public partial class ActiveDirectoryConnectorDNSDetails + { + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDNSDetails class. + /// + public ActiveDirectoryConnectorDNSDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDNSDetails class. + /// + /// List of Active Directory DNS + /// server IP addresses. + /// DNS domain name for which DNS lookups + /// should be forwarded to the Active Directory DNS servers. + /// Replica count for DNS proxy service. Default + /// value is 1. + /// Flag indicating whether to + /// prefer Kubernetes DNS server response over AD DNS server response + /// for IP address lookups. + public ActiveDirectoryConnectorDNSDetails(IList nameserverIPAddresses, string domainName = default(string), long? replicas = default(long?), bool? preferK8sDnsForPtrLookups = default(bool?)) + { + DomainName = domainName; + NameserverIPAddresses = nameserverIPAddresses; + Replicas = replicas; + PreferK8sDnsForPtrLookups = preferK8sDnsForPtrLookups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets DNS domain name for which DNS lookups should be + /// forwarded to the Active Directory DNS servers. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + /// + /// Gets or sets list of Active Directory DNS server IP addresses. + /// + [JsonProperty(PropertyName = "nameserverIPAddresses")] + public IList NameserverIPAddresses { get; set; } + + /// + /// Gets or sets replica count for DNS proxy service. Default value is + /// 1. + /// + [JsonProperty(PropertyName = "replicas")] + public long? Replicas { get; set; } + + /// + /// Gets or sets flag indicating whether to prefer Kubernetes DNS + /// server response over AD DNS server response for IP address lookups. + /// + [JsonProperty(PropertyName = "preferK8sDnsForPtrLookups")] + public bool? PreferK8sDnsForPtrLookups { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDomainDetails.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDomainDetails.cs new file mode 100644 index 0000000000000..470fac6bd351b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDomainDetails.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.Linq; + + /// + /// Active Directory domain details + /// + public partial class ActiveDirectoryConnectorDomainDetails + { + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDomainDetails class. + /// + public ActiveDirectoryConnectorDomainDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDomainDetails class. + /// + /// Name (uppercase) of the Active Directory domain + /// that this AD connector will be associated with. + /// NETBIOS name of the Active + /// Directory domain. + /// The service account + /// provisioning mode for this Active Directory connector. Possible + /// values include: 'automatic', 'manual' + /// The distinguished name of the + /// Active Directory Organizational Unit. + /// null + public ActiveDirectoryConnectorDomainDetails(string realm, string netbiosDomainName = default(string), string serviceAccountProvisioning = default(string), string ouDistinguishedName = default(string), ActiveDirectoryDomainControllers domainControllers = default(ActiveDirectoryDomainControllers)) + { + Realm = realm; + NetbiosDomainName = netbiosDomainName; + ServiceAccountProvisioning = serviceAccountProvisioning; + OuDistinguishedName = ouDistinguishedName; + DomainControllers = domainControllers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name (uppercase) of the Active Directory domain that + /// this AD connector will be associated with. + /// + [JsonProperty(PropertyName = "realm")] + public string Realm { get; set; } + + /// + /// Gets or sets NETBIOS name of the Active Directory domain. + /// + [JsonProperty(PropertyName = "netbiosDomainName")] + public string NetbiosDomainName { get; set; } + + /// + /// Gets or sets the service account provisioning mode for this Active + /// Directory connector. Possible values include: 'automatic', 'manual' + /// + [JsonProperty(PropertyName = "serviceAccountProvisioning")] + public string ServiceAccountProvisioning { get; set; } + + /// + /// Gets or sets the distinguished name of the Active Directory + /// Organizational Unit. + /// + [JsonProperty(PropertyName = "ouDistinguishedName")] + public string OuDistinguishedName { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "domainControllers")] + public ActiveDirectoryDomainControllers DomainControllers { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorProperties.cs new file mode 100644 index 0000000000000..28c330cec0a97 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorProperties.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; + + /// + /// The properties of an Active Directory connector resource + /// + public partial class ActiveDirectoryConnectorProperties + { + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorProperties class. + /// + public ActiveDirectoryConnectorProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorProperties class. + /// + /// null + /// Username and + /// password for domain service account authentication. + /// The provisioning state of the + /// Active Directory connector resource. + /// null + public ActiveDirectoryConnectorProperties(ActiveDirectoryConnectorSpec spec, BasicLoginInformation domainServiceAccountLoginInformation = default(BasicLoginInformation), string provisioningState = default(string), ActiveDirectoryConnectorStatus status = default(ActiveDirectoryConnectorStatus)) + { + DomainServiceAccountLoginInformation = domainServiceAccountLoginInformation; + ProvisioningState = provisioningState; + Spec = spec; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets username and password for domain service account + /// authentication. + /// + [JsonProperty(PropertyName = "domainServiceAccountLoginInformation")] + public BasicLoginInformation DomainServiceAccountLoginInformation { get; set; } + + /// + /// Gets the provisioning state of the Active Directory connector + /// resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "spec")] + public ActiveDirectoryConnectorSpec Spec { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "status")] + public ActiveDirectoryConnectorStatus Status { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorResource.cs new file mode 100644 index 0000000000000..5d002dcfa0755 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorResource.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.Linq; + + /// + /// Active directory connector resource + /// + public partial class ActiveDirectoryConnectorResource : ProxyResource + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorResource + /// class. + /// + public ActiveDirectoryConnectorResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryConnectorResource + /// class. + /// + /// 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ActiveDirectoryConnectorResource(ActiveDirectoryConnectorProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, 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 ActiveDirectoryConnectorProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorSpec.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorSpec.cs new file mode 100644 index 0000000000000..dbe53e5cf96f0 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorSpec.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 specifications of the AD Kubernetes resource. + /// + public partial class ActiveDirectoryConnectorSpec + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorSpec + /// class. + /// + public ActiveDirectoryConnectorSpec() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryConnectorSpec + /// class. + /// + /// null + /// null + public ActiveDirectoryConnectorSpec(ActiveDirectoryConnectorDomainDetails activeDirectory, ActiveDirectoryConnectorDNSDetails dns) + { + ActiveDirectory = activeDirectory; + Dns = dns; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "activeDirectory")] + public ActiveDirectoryConnectorDomainDetails ActiveDirectory { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "dns")] + public ActiveDirectoryConnectorDNSDetails Dns { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorStatus.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorStatus.cs new file mode 100644 index 0000000000000..ec7f25ccd2891 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorStatus.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The status of the Kubernetes custom resource. + /// + public partial class ActiveDirectoryConnectorStatus + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorStatus + /// class. + /// + public ActiveDirectoryConnectorStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryConnectorStatus + /// class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// The time that the custom resource was + /// last updated. + /// The version of the replicaSet + /// associated with the AD connector custom resource. + /// The state of the AD connector custom + /// resource. + public ActiveDirectoryConnectorStatus(IDictionary additionalProperties = default(IDictionary), string lastUpdateTime = default(string), long? observedGeneration = default(long?), string state = default(string)) + { + AdditionalProperties = additionalProperties; + LastUpdateTime = lastUpdateTime; + ObservedGeneration = observedGeneration; + State = state; + 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 the time that the custom resource was last updated. + /// + [JsonProperty(PropertyName = "lastUpdateTime")] + public string LastUpdateTime { get; set; } + + /// + /// Gets or sets the version of the replicaSet associated with the AD + /// connector custom resource. + /// + [JsonProperty(PropertyName = "observedGeneration")] + public long? ObservedGeneration { get; set; } + + /// + /// Gets or sets the state of the AD connector custom resource. + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainController.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainController.cs new file mode 100644 index 0000000000000..f1714df6f6554 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainController.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a domain controller in the AD domain. + /// + public partial class ActiveDirectoryDomainController + { + /// + /// Initializes a new instance of the ActiveDirectoryDomainController + /// class. + /// + public ActiveDirectoryDomainController() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryDomainController + /// class. + /// + /// Fully-qualified domain name of a domain + /// controller in the AD domain. + public ActiveDirectoryDomainController(string hostname) + { + Hostname = hostname; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully-qualified domain name of a domain controller in + /// the AD domain. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainControllers.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainControllers.cs new file mode 100644 index 0000000000000..b696ed3452e84 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainControllers.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Details about the Active Directory domain controllers associated with + /// this AD connector instance + /// + public partial class ActiveDirectoryDomainControllers + { + /// + /// Initializes a new instance of the ActiveDirectoryDomainControllers + /// class. + /// + public ActiveDirectoryDomainControllers() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryDomainControllers + /// class. + /// + /// Information about the Primary + /// Domain Controller (PDC) in the AD domain. + /// null + public ActiveDirectoryDomainControllers(ActiveDirectoryDomainController primaryDomainController = default(ActiveDirectoryDomainController), IList secondaryDomainControllers = default(IList)) + { + PrimaryDomainController = primaryDomainController; + SecondaryDomainControllers = secondaryDomainControllers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets information about the Primary Domain Controller (PDC) + /// in the AD domain. + /// + [JsonProperty(PropertyName = "primaryDomainController")] + public ActiveDirectoryDomainController PrimaryDomainController { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "secondaryDomainControllers")] + public IList SecondaryDomainControllers { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryInformation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryInformation.cs new file mode 100644 index 0000000000000..83872811700cd --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryInformation.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 System.Linq; + + /// + /// Active Directory information that related to the resource. + /// + public partial class ActiveDirectoryInformation + { + /// + /// Initializes a new instance of the ActiveDirectoryInformation class. + /// + public ActiveDirectoryInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryInformation class. + /// + /// Keytab information that is used for + /// the Sql Managed Instance when Active Directory authentication is + /// used. + public ActiveDirectoryInformation(KeytabInformation keytabInformation = default(KeytabInformation)) + { + KeytabInformation = keytabInformation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets keytab information that is used for the Sql Managed + /// Instance when Active Directory authentication is used. + /// + [JsonProperty(PropertyName = "keytabInformation")] + public KeytabInformation KeytabInformation { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs new file mode 100644 index 0000000000000..b7fe4250ecfca --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.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 ArcSqlManagedInstanceLicenseType. + /// + public static class ArcSqlManagedInstanceLicenseType + { + public const string BasePrice = "BasePrice"; + public const string LicenseIncluded = "LicenseIncluded"; + public const string DisasterRecovery = "DisasterRecovery"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs new file mode 100644 index 0000000000000..161132f7e6f15 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs @@ -0,0 +1,27 @@ +// +// 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 Undefined = "Undefined"; + public const string Free = "Free"; + public const string HADR = "HADR"; + public const string ServerCAL = "ServerCAL"; + public const string LicenseOnly = "LicenseOnly"; + public const string PAYG = "PAYG"; + public const string Paid = "Paid"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AzureEntityResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 0000000000000..ced7f8e1f2706 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs new file mode 100644 index 0000000000000..b8369bc86e103 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs new file mode 100644 index 0000000000000..b151c196c8db8 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs new file mode 100644 index 0000000000000..11dcb64c443cf --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.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 ConnectionStatus. + /// + public static class ConnectionStatus + { + public const string Connected = "Connected"; + public const string Disconnected = "Disconnected"; + public const string Registered = "Registered"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CreatedByType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..439505316eddb --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CreatedByType.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 CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs new file mode 100644 index 0000000000000..165519e87eac2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs @@ -0,0 +1,165 @@ +// +// 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 + /// Deprecated. Azure Arc Data + /// Services data controller no longer expose any endpoint. All traffic + /// are exposed through Kubernetes native API. + /// Login credential for + /// metrics dashboard on the Kubernetes cluster. + /// Login credential for logs + /// dashboard on the Kubernetes cluster. + /// Deprecated. Service principal + /// is deprecated in favor of Arc Kubernetes service extension managed + /// identity. + /// The provisioning state of the Arc + /// Data Controller resource. + /// 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), BasicLoginInformation metricsDashboardCredential = default(BasicLoginInformation), BasicLoginInformation logsDashboardCredential = 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; + MetricsDashboardCredential = metricsDashboardCredential; + LogsDashboardCredential = logsDashboardCredential; + 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; } + + /// + /// Gets or sets deprecated. Azure Arc Data Services data controller no + /// longer expose any endpoint. All traffic are exposed through + /// Kubernetes native API. + /// + [JsonProperty(PropertyName = "basicLoginInformation")] + public BasicLoginInformation BasicLoginInformation { get; set; } + + /// + /// Gets or sets login credential for metrics dashboard on the + /// Kubernetes cluster. + /// + [JsonProperty(PropertyName = "metricsDashboardCredential")] + public BasicLoginInformation MetricsDashboardCredential { get; set; } + + /// + /// Gets or sets login credential for logs dashboard on the Kubernetes + /// cluster. + /// + [JsonProperty(PropertyName = "logsDashboardCredential")] + public BasicLoginInformation LogsDashboardCredential { get; set; } + + /// + /// + [JsonProperty(PropertyName = "logAnalyticsWorkspaceConfig")] + public LogAnalyticsWorkspaceConfig LogAnalyticsWorkspaceConfig { get; set; } + + /// + /// Gets or sets deprecated. Service principal is deprecated in favor + /// of Arc Kubernetes service extension managed identity. + /// + [JsonProperty(PropertyName = "uploadServicePrincipal")] + public UploadServicePrincipal UploadServicePrincipal { get; set; } + + /// + /// Gets the provisioning state of the Arc Data Controller resource. + /// + [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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs new file mode 100644 index 0000000000000..3211f7a7cdb0e --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.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.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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// 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), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, systemData, tags) + { + 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs new file mode 100644 index 0000000000000..bbae6e1d4c464 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.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; + + /// + /// 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 + /// The data controller's properties + public DataControllerUpdate(IDictionary tags = default(IDictionary), DataControllerProperties properties = default(DataControllerProperties)) + { + Tags = tags; + Properties = properties; + 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 data controller's properties + /// + [JsonProperty(PropertyName = "properties")] + public DataControllerProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DatabaseState.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DatabaseState.cs new file mode 100644 index 0000000000000..cd6767fdf0f6d --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DatabaseState.cs @@ -0,0 +1,29 @@ +// +// 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 DatabaseState. + /// + public static class DatabaseState + { + public const string Online = "Online"; + public const string Restoring = "Restoring"; + public const string Recovering = "Recovering"; + public const string RecoveryPending = "RecoveryPending"; + public const string Suspect = "Suspect"; + public const string Emergency = "Emergency"; + public const string Offline = "Offline"; + public const string Copying = "Copying"; + public const string OfflineSecondary = "OfflineSecondary"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs new file mode 100644 index 0000000000000..caad97050980d --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs new file mode 100644 index 0000000000000..f965ddb7ea360 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs @@ -0,0 +1,27 @@ +// +// 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"; + public const string BusinessIntelligence = "Business Intelligence"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..a7dc6e20f72d2 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs new file mode 100644 index 0000000000000..c8ccab35c370b --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..d3c8a4b94e719 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs new file mode 100644 index 0000000000000..a85bda3f8db68 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs new file mode 100644 index 0000000000000..6dad751b48c60 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupPartnerSyncMode.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupPartnerSyncMode.cs new file mode 100644 index 0000000000000..1ef5e22750a8e --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupPartnerSyncMode.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 FailoverGroupPartnerSyncMode. + /// + public static class FailoverGroupPartnerSyncMode + { + public const string Async = "async"; + public const string Sync = "sync"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupProperties.cs new file mode 100644 index 0000000000000..28bc9470ecb55 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupProperties.cs @@ -0,0 +1,82 @@ +// +// 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 properties of a failover group resource. + /// + public partial class FailoverGroupProperties + { + /// + /// Initializes a new instance of the FailoverGroupProperties class. + /// + public FailoverGroupProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FailoverGroupProperties class. + /// + /// The resource ID of the + /// partner SQL managed instance. + /// The specifications of the failover group + /// resource. + /// The provisioning state of the + /// failover group resource. Possible values include: 'Succeeded', + /// 'Failed', 'Canceled', 'Accepted' + /// The status of the failover group custom + /// resource. + public FailoverGroupProperties(string partnerManagedInstanceId, FailoverGroupSpec spec, string provisioningState = default(string), FailoverGroupStatus status = default(FailoverGroupStatus)) + { + ProvisioningState = provisioningState; + PartnerManagedInstanceId = partnerManagedInstanceId; + Spec = spec; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the provisioning state of the failover group resource. + /// Possible values include: 'Succeeded', 'Failed', 'Canceled', + /// 'Accepted' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the resource ID of the partner SQL managed instance. + /// + [JsonProperty(PropertyName = "partnerManagedInstanceId")] + public string PartnerManagedInstanceId { get; set; } + + /// + /// Gets or sets the specifications of the failover group resource. + /// + [JsonProperty(PropertyName = "spec")] + public FailoverGroupSpec Spec { get; set; } + + /// + /// Gets or sets the status of the failover group custom resource. + /// + [JsonProperty(PropertyName = "status")] + public FailoverGroupStatus Status { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupResource.cs new file mode 100644 index 0000000000000..f0fccd346e82f --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupResource.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 System.Linq; + + /// + /// A failover group resource. + /// + public partial class FailoverGroupResource : ProxyResource + { + /// + /// Initializes a new instance of the FailoverGroupResource class. + /// + public FailoverGroupResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FailoverGroupResource class. + /// + /// 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public FailoverGroupResource(FailoverGroupProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, 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 FailoverGroupProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupSpec.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupSpec.cs new file mode 100644 index 0000000000000..ef7b67dd34fe6 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupSpec.cs @@ -0,0 +1,129 @@ +// +// 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 specifications of the failover group resource. + /// + public partial class FailoverGroupSpec + { + /// + /// Initializes a new instance of the FailoverGroupSpec class. + /// + public FailoverGroupSpec() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FailoverGroupSpec class. + /// + /// The role of the SQL managed instance in this + /// failover group. Possible values include: 'primary', 'secondary', + /// 'force-primary-allow-data-loss', 'force-secondary' + /// Unmatched properties from the + /// message are deserialized this collection + /// The shared name of the failover group for + /// this SQL managed instance. Both SQL managed instance and its + /// partner have to use the same shared name. + /// The name of the SQL managed + /// instance with this failover group role. + /// The name of the partner SQL + /// managed instance. + /// The mirroring endpoint URL of the + /// partner SQL managed instance. + /// The mirroring endpoint public + /// certificate for the partner SQL managed instance. Only PEM format + /// is supported. + /// The partner sync mode of the SQL + /// managed instance. Possible values include: 'async', 'sync' + public FailoverGroupSpec(string role, IDictionary additionalProperties = default(IDictionary), string sharedName = default(string), string sourceManagedInstance = default(string), string partnerManagedInstance = default(string), string partnerMirroringURL = default(string), string partnerMirroringCert = default(string), string partnerSyncMode = default(string)) + { + AdditionalProperties = additionalProperties; + SharedName = sharedName; + SourceManagedInstance = sourceManagedInstance; + PartnerManagedInstance = partnerManagedInstance; + PartnerMirroringURL = partnerMirroringURL; + PartnerMirroringCert = partnerMirroringCert; + PartnerSyncMode = partnerSyncMode; + Role = role; + 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 the shared name of the failover group for this SQL + /// managed instance. Both SQL managed instance and its partner have to + /// use the same shared name. + /// + [JsonProperty(PropertyName = "sharedName")] + public string SharedName { get; set; } + + /// + /// Gets or sets the name of the SQL managed instance with this + /// failover group role. + /// + [JsonProperty(PropertyName = "sourceManagedInstance")] + public string SourceManagedInstance { get; set; } + + /// + /// Gets or sets the name of the partner SQL managed instance. + /// + [JsonProperty(PropertyName = "partnerManagedInstance")] + public string PartnerManagedInstance { get; set; } + + /// + /// Gets or sets the mirroring endpoint URL of the partner SQL managed + /// instance. + /// + [JsonProperty(PropertyName = "partnerMirroringURL")] + public string PartnerMirroringURL { get; set; } + + /// + /// Gets or sets the mirroring endpoint public certificate for the + /// partner SQL managed instance. Only PEM format is supported. + /// + [JsonProperty(PropertyName = "partnerMirroringCert")] + public string PartnerMirroringCert { get; set; } + + /// + /// Gets or sets the partner sync mode of the SQL managed instance. + /// Possible values include: 'async', 'sync' + /// + [JsonProperty(PropertyName = "partnerSyncMode")] + public string PartnerSyncMode { get; set; } + + /// + /// Gets or sets the role of the SQL managed instance in this failover + /// group. Possible values include: 'primary', 'secondary', + /// 'force-primary-allow-data-loss', 'force-secondary' + /// + [JsonProperty(PropertyName = "role")] + public string Role { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupStatus.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupStatus.cs new file mode 100644 index 0000000000000..d4a3b7481d67b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/FailoverGroupStatus.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The status of the Kubernetes custom resource. + /// + public partial class FailoverGroupStatus + { + /// + /// Initializes a new instance of the FailoverGroupStatus class. + /// + public FailoverGroupStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FailoverGroupStatus class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// The time that the custom resource was + /// last updated. + /// The version of the replicaSet + /// associated with the failover group custom resource. + /// The state of the failover group custom + /// resource. Possible values include: 'Waiting', 'Succeeded', + /// 'Failed' + /// The message in case of a failure in the + /// failover group. + /// The role of the managed instance in the failover + /// group. Possible values include: 'primary', 'secondary', + /// 'force-primary-allow-data-loss', 'force-secondary' + /// A list of failover group replicas. + public FailoverGroupStatus(IDictionary additionalProperties = default(IDictionary), System.DateTime? lastUpdateTime = default(System.DateTime?), long? observedGeneration = default(long?), string state = default(string), string results = default(string), string role = default(string), IList replicas = default(IList)) + { + AdditionalProperties = additionalProperties; + LastUpdateTime = lastUpdateTime; + ObservedGeneration = observedGeneration; + State = state; + Results = results; + Role = role; + 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; } + + /// + /// Gets or sets the time that the custom resource was last updated. + /// + [JsonProperty(PropertyName = "lastUpdateTime")] + public System.DateTime? LastUpdateTime { get; set; } + + /// + /// Gets or sets the version of the replicaSet associated with the + /// failover group custom resource. + /// + [JsonProperty(PropertyName = "observedGeneration")] + public long? ObservedGeneration { get; set; } + + /// + /// Gets or sets the state of the failover group custom resource. + /// Possible values include: 'Waiting', 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets the message in case of a failure in the failover + /// group. + /// + [JsonProperty(PropertyName = "results")] + public string Results { get; set; } + + /// + /// Gets or sets the role of the managed instance in the failover + /// group. Possible values include: 'primary', 'secondary', + /// 'force-primary-allow-data-loss', 'force-secondary' + /// + [JsonProperty(PropertyName = "role")] + public string Role { get; set; } + + /// + /// Gets or sets a list of failover group replicas. + /// + [JsonProperty(PropertyName = "replicas")] + public IList Replicas { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/HostType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/HostType.cs new file mode 100644 index 0000000000000..fd9cb56e23914 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/HostType.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for HostType. + /// + public static class HostType + { + public const string AzureVirtualMachine = "Azure Virtual Machine"; + public const string AzureVMWareVirtualMachine = "Azure VMWare Virtual Machine"; + public const string AzureKubernetesService = "Azure Kubernetes Service"; + public const string AWSVMWareVirtualMachine = "AWS VMWare Virtual Machine"; + public const string AWSKubernetesService = "AWS Kubernetes Service"; + public const string GCPVMWareVirtualMachine = "GCP VMWare Virtual Machine"; + public const string GCPKubernetesService = "GCP Kubernetes Service"; + public const string Container = "Container"; + public const string VirtualMachine = "Virtual Machine"; + public const string PhysicalServer = "Physical Server"; + public const string AWSVirtualMachine = "AWS Virtual Machine"; + public const string GCPVirtualMachine = "GCP Virtual Machine"; + public const string Other = "Other"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Identity.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Identity.cs new file mode 100644 index 0000000000000..ff2fd4fdd68a1 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs new file mode 100644 index 0000000000000..1d806b0447e12 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/InstanceFailoverGroupRole.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/InstanceFailoverGroupRole.cs new file mode 100644 index 0000000000000..3c1e8084a3f5b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/InstanceFailoverGroupRole.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 InstanceFailoverGroupRole. + /// + public static class InstanceFailoverGroupRole + { + public const string Primary = "primary"; + public const string Secondary = "secondary"; + public const string ForcePrimaryAllowDataLoss = "force-primary-allow-data-loss"; + public const string ForceSecondary = "force-secondary"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs new file mode 100644 index 0000000000000..95c23fb027b1a --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs new file mode 100644 index 0000000000000..db19e7aa84ccd --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs new file mode 100644 index 0000000000000..80930269bb8e1 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/KeytabInformation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/KeytabInformation.cs new file mode 100644 index 0000000000000..adac4417513d6 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/KeytabInformation.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; + + /// + /// Keytab used for authenticate with Active Directory. + /// + public partial class KeytabInformation + { + /// + /// Initializes a new instance of the KeytabInformation class. + /// + public KeytabInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeytabInformation class. + /// + /// A base64-encoded keytab. + public KeytabInformation(string keytab = default(string)) + { + Keytab = keytab; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a base64-encoded keytab. + /// + [JsonProperty(PropertyName = "keytab")] + public string Keytab { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs new file mode 100644 index 0000000000000..1ec7ae9997d8a --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs new file mode 100644 index 0000000000000..f9b283b459923 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs new file mode 100644 index 0000000000000..65a82ecc0f022 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 0000000000000..9fc055c7362ce --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs new file mode 100644 index 0000000000000..80b0feed04767 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..27c055e3441fb --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Plan.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Plan.cs new file mode 100644 index 0000000000000..5687705819ae0 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstance.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstance.cs new file mode 100644 index 0000000000000..61e42d6abf721 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstance.cs @@ -0,0 +1,82 @@ +// +// 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 Postgres Instance. + /// + public partial class PostgresInstance : TrackedResource + { + /// + /// Initializes a new instance of the PostgresInstance class. + /// + public PostgresInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstance 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// The extendedLocation of the + /// resource. + /// Resource sku. + public PostgresInstance(string location, PostgresInstanceProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation), PostgresInstanceSku sku = default(PostgresInstanceSku)) + : base(location, id, name, type, systemData, tags) + { + ExtendedLocation = extendedLocation; + Properties = properties; + Sku = sku; + 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 null + /// + [JsonProperty(PropertyName = "properties")] + public PostgresInstanceProperties Properties { get; set; } + + /// + /// Gets or sets resource sku. + /// + [JsonProperty(PropertyName = "sku")] + public PostgresInstanceSku Sku { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceProperties.cs new file mode 100644 index 0000000000000..2c04755837b8b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceProperties.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; + + /// + /// Postgres Instance properties. + /// + public partial class PostgresInstanceProperties + { + /// + /// Initializes a new instance of the PostgresInstanceProperties class. + /// + public PostgresInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstanceProperties class. + /// + /// The data controller id + /// The instance admin + /// Username and password for basic + /// authentication. + /// The raw kubernetes information + /// Last uploaded date from Kubernetes + /// cluster. Defaults to current date time + /// The provisioning state of the Azure + /// Arc-enabled PostgreSQL instance. + public PostgresInstanceProperties(string dataControllerId = default(string), string admin = default(string), BasicLoginInformation basicLoginInformation = default(BasicLoginInformation), object k8sRaw = default(object), System.DateTime? lastUploadedDate = default(System.DateTime?), string provisioningState = default(string)) + { + DataControllerId = dataControllerId; + Admin = admin; + BasicLoginInformation = basicLoginInformation; + K8sRaw = k8sRaw; + LastUploadedDate = lastUploadedDate; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the data controller id + /// + [JsonProperty(PropertyName = "dataControllerId")] + public string DataControllerId { get; set; } + + /// + /// Gets or sets the instance admin + /// + [JsonProperty(PropertyName = "admin")] + public string Admin { get; set; } + + /// + /// Gets or sets username and password for basic authentication. + /// + [JsonProperty(PropertyName = "basicLoginInformation")] + public BasicLoginInformation BasicLoginInformation { get; set; } + + /// + /// Gets or sets the raw kubernetes information + /// + [JsonProperty(PropertyName = "k8sRaw")] + public object K8sRaw { 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; } + + /// + /// Gets the provisioning state of the Azure Arc-enabled PostgreSQL + /// instance. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSku.cs new file mode 100644 index 0000000000000..ffcfe0d197a0f --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSku.cs @@ -0,0 +1,69 @@ +// +// 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 Database for + /// PostgresSQL - Azure Arc + /// + public partial class PostgresInstanceSku : CommonSku + { + /// + /// Initializes a new instance of the PostgresInstanceSku class. + /// + public PostgresInstanceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstanceSku 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. + /// This field is required to be implemented by the + /// Resource Provider if the service has more than one tier. Possible + /// values include: 'Hyperscale' + public PostgresInstanceSku(string name, bool? dev = default(bool?), string size = default(string), string family = default(string), int? capacity = default(int?), PostgresInstanceSkuTier? tier = default(PostgresInstanceSkuTier?)) + : base(name, dev, size, family, capacity) + { + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this field is required to be implemented by the + /// Resource Provider if the service has more than one tier. Possible + /// values include: 'Hyperscale' + /// + [JsonProperty(PropertyName = "tier")] + public PostgresInstanceSkuTier? Tier { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSkuTier.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSkuTier.cs new file mode 100644 index 0000000000000..1c84d8c6758e9 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSkuTier.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 PostgresInstanceSkuTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PostgresInstanceSkuTier + { + [EnumMember(Value = "Hyperscale")] + Hyperscale + } + internal static class PostgresInstanceSkuTierEnumExtension + { + internal static string ToSerializedValue(this PostgresInstanceSkuTier? value) + { + return value == null ? null : ((PostgresInstanceSkuTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this PostgresInstanceSkuTier value) + { + switch( value ) + { + case PostgresInstanceSkuTier.Hyperscale: + return "Hyperscale"; + } + return null; + } + + internal static PostgresInstanceSkuTier? ParsePostgresInstanceSkuTier(this string value) + { + switch( value ) + { + case "Hyperscale": + return PostgresInstanceSkuTier.Hyperscale; + } + return null; + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceUpdate.cs new file mode 100644 index 0000000000000..e5eea763d4a50 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceUpdate.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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An update to a Postgres Instance. + /// + public partial class PostgresInstanceUpdate + { + /// + /// Initializes a new instance of the PostgresInstanceUpdate class. + /// + public PostgresInstanceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstanceUpdate class. + /// + /// Resource tags. + public PostgresInstanceUpdate(IDictionary tags = default(IDictionary), PostgresInstanceProperties properties = default(PostgresInstanceProperties)) + { + Tags = tags; + Properties = properties; + 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; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public PostgresInstanceProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProvisioningState.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..1ff181de44023 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProvisioningState.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 ProvisioningState. + /// + public static class ProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Accepted = "Accepted"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..12c8463f34ce2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/RecoveryMode.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/RecoveryMode.cs new file mode 100644 index 0000000000000..7d2c5cbd2fed4 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/RecoveryMode.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 RecoveryMode. + /// + public static class RecoveryMode + { + public const string Full = "Full"; + public const string BulkLogged = "Bulk-logged"; + public const string Simple = "Simple"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..8ca97e954c38a --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs @@ -0,0 +1,89 @@ +// +// 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; + + /// + /// Resource + /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// + 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + SystemData = systemData; + 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceIdentityType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 0000000000000..80c1a2de0c1f6 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs new file mode 100644 index 0000000000000..df1c844754cf0 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs @@ -0,0 +1,117 @@ +// +// 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; + + /// + /// The resource model definition containing the full set of allowed + /// properties for a resource. Except properties bag, there cannot be a top + /// level property outside of this set. + /// + public partial class ResourceModelWithAllowedPropertySet : IResource + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + public ResourceModelWithAllowedPropertySet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + /// The fully qualified resource ID of the + /// resource that manages this resource. Indicates if this resource is + /// managed by another Azure resource. If this is present, complete + /// mode deployment will not delete the resource if it is removed from + /// the template since it is managed by another resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// The etag field is *not* required. If it is + /// provided in the response body, it must also be provided as a header + /// per the normal etag convention. Entity tags are used for comparing + /// two or more entities from the same requested resource. HTTP/1.1 + /// uses entity tags in the etag (section 14.19), If-Match (section + /// 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) + /// header fields. + public ResourceModelWithAllowedPropertySet(string managedBy = default(string), string kind = default(string), string etag = default(string), ResourceModelWithAllowedPropertySetIdentity identity = default(ResourceModelWithAllowedPropertySetIdentity), ResourceModelWithAllowedPropertySetSku sku = default(ResourceModelWithAllowedPropertySetSku), ResourceModelWithAllowedPropertySetPlan plan = default(ResourceModelWithAllowedPropertySetPlan)) + { + ManagedBy = managedBy; + Kind = kind; + Etag = etag; + Identity = identity; + Sku = sku; + Plan = plan; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fully qualified resource ID of the resource that + /// manages this resource. Indicates if this resource is managed by + /// another Azure resource. If this is present, complete mode + /// deployment will not delete the resource if it is removed from the + /// template since it is managed by another resource. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets the etag field is *not* required. If it is provided in the + /// response body, it must also be provided as a header per the normal + /// etag convention. Entity tags are used for comparing two or more + /// entities from the same requested resource. HTTP/1.1 uses entity + /// tags in the etag (section 14.19), If-Match (section 14.24), + /// If-None-Match (section 14.26), and If-Range (section 14.27) header + /// fields. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ResourceModelWithAllowedPropertySetIdentity Identity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public ResourceModelWithAllowedPropertySetSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "plan")] + public ResourceModelWithAllowedPropertySetPlan Plan { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs new file mode 100644 index 0000000000000..bd89f490d8568 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs @@ -0,0 +1,47 @@ +// +// 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; + + public partial class ResourceModelWithAllowedPropertySetIdentity : Identity + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + public ResourceModelWithAllowedPropertySetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public ResourceModelWithAllowedPropertySetIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + : base(principalId, tenantId, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs new file mode 100644 index 0000000000000..6083f2f592bd0 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.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 System.Linq; + + public partial class ResourceModelWithAllowedPropertySetPlan : Plan + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan class. + /// + public ResourceModelWithAllowedPropertySetPlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan 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 ResourceModelWithAllowedPropertySetPlan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + : base(name, publisher, product, promotionCode, version) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs new file mode 100644 index 0000000000000..8df6e5a388d97 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.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 System.Linq; + + public partial class ResourceModelWithAllowedPropertySetSku : Sku + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + public ResourceModelWithAllowedPropertySetSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + /// The name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// Possible values include: 'Free', 'Basic', + /// 'Standard', 'Premium' + /// 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 ResourceModelWithAllowedPropertySetSku(string name, SkuTier? tier = default(SkuTier?), string size = default(string), string family = default(string), int? capacity = default(int?)) + : base(name, tier, size, family, capacity) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Sku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Sku.cs new file mode 100644 index 0000000000000..ef2bafa9726d8 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Sku.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 + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// The name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// Possible values include: 'Free', 'Basic', + /// 'Standard', 'Premium' + /// 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 Sku(string name, SkuTier? tier = default(SkuTier?), string size = default(string), string family = default(string), int? capacity = default(int?)) + { + Name = name; + Tier = tier; + 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. Ex - P3. It is typically a + /// letter+number code + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets possible values include: 'Free', 'Basic', 'Standard', + /// 'Premium' + /// + [JsonProperty(PropertyName = "tier")] + public SkuTier? Tier { 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SkuTier.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SkuTier.cs new file mode 100644 index 0000000000000..26f7fdbc882ff --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SkuTier.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SkuTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SkuTier + { + [EnumMember(Value = "Free")] + Free, + [EnumMember(Value = "Basic")] + Basic, + [EnumMember(Value = "Standard")] + Standard, + [EnumMember(Value = "Premium")] + Premium + } + internal static class SkuTierEnumExtension + { + internal static string ToSerializedValue(this SkuTier? value) + { + return value == null ? null : ((SkuTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SkuTier value) + { + switch( value ) + { + case SkuTier.Free: + return "Free"; + case SkuTier.Basic: + return "Basic"; + case SkuTier.Standard: + return "Standard"; + case SkuTier.Premium: + return "Premium"; + } + return null; + } + + internal static SkuTier? ParseSkuTier(this string value) + { + switch( value ) + { + case "Free": + return SkuTier.Free; + case "Basic": + return SkuTier.Basic; + case "Standard": + return SkuTier.Standard; + case "Premium": + return SkuTier.Premium; + } + return null; + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs new file mode 100644 index 0000000000000..cebfbb80f8a92 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs @@ -0,0 +1,82 @@ +// +// 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// 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), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation), SqlManagedInstanceSku sku = default(SqlManagedInstanceSku)) + : base(location, id, name, type, systemData, tags) + { + 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs new file mode 100644 index 0000000000000..9bdcc2beecb81 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs new file mode 100644 index 0000000000000..b7103ec9260c2 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs new file mode 100644 index 0000000000000..c27b4dbbbc88f --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs @@ -0,0 +1,158 @@ +// +// 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 provisioning state of the + /// Arc-enabled SQL Managed Instance resource. + /// Active Directory + /// information related to this SQL Managed Instance. + /// The license type to apply for this + /// managed instance. Possible values include: 'BasePrice', + /// 'LicenseIncluded', 'DisasterRecovery' + /// 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), ActiveDirectoryInformation activeDirectoryInformation = default(ActiveDirectoryInformation), string licenseType = default(string), string clusterId = default(string), string extensionId = default(string)) + { + DataControllerId = dataControllerId; + Admin = admin; + StartTime = startTime; + EndTime = endTime; + K8sRaw = k8sRaw; + BasicLoginInformation = basicLoginInformation; + LastUploadedDate = lastUploadedDate; + ProvisioningState = provisioningState; + ActiveDirectoryInformation = activeDirectoryInformation; + 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; } + + /// + /// Gets the provisioning state of the Arc-enabled SQL Managed Instance + /// resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets active Directory information related to this SQL + /// Managed Instance. + /// + [JsonProperty(PropertyName = "activeDirectoryInformation")] + public ActiveDirectoryInformation ActiveDirectoryInformation { get; set; } + + /// + /// Gets or sets the license type to apply for this managed instance. + /// Possible values include: 'BasePrice', 'LicenseIncluded', + /// 'DisasterRecovery' + /// + [JsonProperty(PropertyName = "licenseType")] + public string 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs new file mode 100644 index 0000000000000..2354de6a44fbb --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs @@ -0,0 +1,104 @@ +// +// 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. + /// The SKU family + /// The SKU capacity + 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; } + + /// + /// Gets or sets the SKU family + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets the SKU capacity + /// + [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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs new file mode 100644 index 0000000000000..1a840475e662a --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs new file mode 100644 index 0000000000000..381adf9bf5abc --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResource.cs new file mode 100644 index 0000000000000..9e19f18497a51 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResource.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Arc Sql Server database + /// + public partial class SqlServerDatabaseResource : TrackedResource + { + /// + /// Initializes a new instance of the SqlServerDatabaseResource class. + /// + public SqlServerDatabaseResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerDatabaseResource class. + /// + /// The geo-location where the resource + /// lives + /// Properties of Arc Sql Server + /// database + /// 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + public SqlServerDatabaseResource(string location, SqlServerDatabaseResourceProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary)) + : base(location, id, name, type, systemData, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of Arc Sql Server database + /// + [JsonProperty(PropertyName = "properties")] + public SqlServerDatabaseResourceProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourceProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourceProperties.cs new file mode 100644 index 0000000000000..81a88213b0409 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourceProperties.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; + + /// + /// The properties of Arc Sql Server database resource + /// + public partial class SqlServerDatabaseResourceProperties + { + /// + /// Initializes a new instance of the + /// SqlServerDatabaseResourceProperties class. + /// + public SqlServerDatabaseResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlServerDatabaseResourceProperties class. + /// + /// Collation of the database. + /// Creation date of the + /// database. + /// Compatibility level of the + /// database + /// Size of the database. + /// Space left of the database. + /// State of the database. Possible values include: + /// 'Online', 'Restoring', 'Recovering', 'RecoveryPending', 'Suspect', + /// 'Emergency', 'Offline', 'Copying', 'OfflineSecondary' + /// Whether the database is read only or + /// not. + /// Status of the database. Possible values + /// include: 'Full', 'Bulk-logged', 'Simple' + /// List of features that are enabled for + /// the database + /// The provisioning state of the + /// Arc-enabled SQL Server database resource. + public SqlServerDatabaseResourceProperties(string collationName = default(string), System.DateTime? databaseCreationDate = default(System.DateTime?), int? compatibilityLevel = default(int?), double? sizeMB = default(double?), double? spaceAvailableMB = default(double?), string state = default(string), bool? isReadOnly = default(bool?), string recoveryMode = default(string), SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions = default(SqlServerDatabaseResourcePropertiesDatabaseOptions), SqlServerDatabaseResourcePropertiesBackupInformation backupInformation = default(SqlServerDatabaseResourcePropertiesBackupInformation), string provisioningState = default(string)) + { + CollationName = collationName; + DatabaseCreationDate = databaseCreationDate; + CompatibilityLevel = compatibilityLevel; + SizeMB = sizeMB; + SpaceAvailableMB = spaceAvailableMB; + State = state; + IsReadOnly = isReadOnly; + RecoveryMode = recoveryMode; + DatabaseOptions = databaseOptions; + BackupInformation = backupInformation; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets collation of the database. + /// + [JsonProperty(PropertyName = "collationName")] + public string CollationName { get; set; } + + /// + /// Gets or sets creation date of the database. + /// + [JsonProperty(PropertyName = "databaseCreationDate")] + public System.DateTime? DatabaseCreationDate { get; set; } + + /// + /// Gets or sets compatibility level of the database + /// + [JsonProperty(PropertyName = "compatibilityLevel")] + public int? CompatibilityLevel { get; set; } + + /// + /// Gets or sets size of the database. + /// + [JsonProperty(PropertyName = "sizeMB")] + public double? SizeMB { get; set; } + + /// + /// Gets or sets space left of the database. + /// + [JsonProperty(PropertyName = "spaceAvailableMB")] + public double? SpaceAvailableMB { get; set; } + + /// + /// Gets or sets state of the database. Possible values include: + /// 'Online', 'Restoring', 'Recovering', 'RecoveryPending', 'Suspect', + /// 'Emergency', 'Offline', 'Copying', 'OfflineSecondary' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets whether the database is read only or not. + /// + [JsonProperty(PropertyName = "isReadOnly")] + public bool? IsReadOnly { get; set; } + + /// + /// Gets or sets status of the database. Possible values include: + /// 'Full', 'Bulk-logged', 'Simple' + /// + [JsonProperty(PropertyName = "recoveryMode")] + public string RecoveryMode { get; set; } + + /// + /// Gets or sets list of features that are enabled for the database + /// + [JsonProperty(PropertyName = "databaseOptions")] + public SqlServerDatabaseResourcePropertiesDatabaseOptions DatabaseOptions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "backupInformation")] + public SqlServerDatabaseResourcePropertiesBackupInformation BackupInformation { get; set; } + + /// + /// Gets the provisioning state of the Arc-enabled SQL Server database + /// resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesBackupInformation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesBackupInformation.cs new file mode 100644 index 0000000000000..6b7cd200ba9cc --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesBackupInformation.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class SqlServerDatabaseResourcePropertiesBackupInformation + { + /// + /// Initializes a new instance of the + /// SqlServerDatabaseResourcePropertiesBackupInformation class. + /// + public SqlServerDatabaseResourcePropertiesBackupInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlServerDatabaseResourcePropertiesBackupInformation class. + /// + /// Date time of last full backup. + /// Date time of last log backup. + public SqlServerDatabaseResourcePropertiesBackupInformation(System.DateTime? lastFullBackup = default(System.DateTime?), System.DateTime? lastLogBackup = default(System.DateTime?)) + { + LastFullBackup = lastFullBackup; + LastLogBackup = lastLogBackup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets date time of last full backup. + /// + [JsonProperty(PropertyName = "lastFullBackup")] + public System.DateTime? LastFullBackup { get; set; } + + /// + /// Gets or sets date time of last log backup. + /// + [JsonProperty(PropertyName = "lastLogBackup")] + public System.DateTime? LastLogBackup { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesDatabaseOptions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesDatabaseOptions.cs new file mode 100644 index 0000000000000..722919f2905fc --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseResourcePropertiesDatabaseOptions.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.Linq; + + /// + /// List of features that are enabled for the database + /// + public partial class SqlServerDatabaseResourcePropertiesDatabaseOptions + { + /// + /// Initializes a new instance of the + /// SqlServerDatabaseResourcePropertiesDatabaseOptions class. + /// + public SqlServerDatabaseResourcePropertiesDatabaseOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlServerDatabaseResourcePropertiesDatabaseOptions class. + /// + public SqlServerDatabaseResourcePropertiesDatabaseOptions(bool? isAutoCloseOn = default(bool?), bool? isAutoShrinkOn = default(bool?), bool? isAutoCreateStatsOn = default(bool?), bool? isAutoUpdateStatsOn = default(bool?), bool? isRemoteDataArchiveEnabled = default(bool?), bool? isMemoryOptimizationEnabled = default(bool?), bool? isEncrypted = default(bool?), bool? isTrustworthyOn = default(bool?)) + { + IsAutoCloseOn = isAutoCloseOn; + IsAutoShrinkOn = isAutoShrinkOn; + IsAutoCreateStatsOn = isAutoCreateStatsOn; + IsAutoUpdateStatsOn = isAutoUpdateStatsOn; + IsRemoteDataArchiveEnabled = isRemoteDataArchiveEnabled; + IsMemoryOptimizationEnabled = isMemoryOptimizationEnabled; + IsEncrypted = isEncrypted; + IsTrustworthyOn = isTrustworthyOn; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "isAutoCloseOn")] + public bool? IsAutoCloseOn { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isAutoShrinkOn")] + public bool? IsAutoShrinkOn { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isAutoCreateStatsOn")] + public bool? IsAutoCreateStatsOn { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isAutoUpdateStatsOn")] + public bool? IsAutoUpdateStatsOn { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isRemoteDataArchiveEnabled")] + public bool? IsRemoteDataArchiveEnabled { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isMemoryOptimizationEnabled")] + public bool? IsMemoryOptimizationEnabled { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isEncrypted")] + public bool? IsEncrypted { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isTrustworthyOn")] + public bool? IsTrustworthyOn { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseUpdate.cs new file mode 100644 index 0000000000000..b3e3b8a11c770 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerDatabaseUpdate.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; + + /// + /// An update to database resource. + /// + public partial class SqlServerDatabaseUpdate + { + /// + /// Initializes a new instance of the SqlServerDatabaseUpdate class. + /// + public SqlServerDatabaseUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerDatabaseUpdate class. + /// + /// Resource tags. + /// The data controller's properties + public SqlServerDatabaseUpdate(IDictionary tags = default(IDictionary), SqlServerDatabaseResourceProperties properties = default(SqlServerDatabaseResourceProperties)) + { + Tags = tags; + Properties = properties; + 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 data controller's properties + /// + [JsonProperty(PropertyName = "properties")] + public SqlServerDatabaseResourceProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs new file mode 100644 index 0000000000000..45fe89978c576 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs @@ -0,0 +1,65 @@ +// +// 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// null + public SqlServerInstance(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), SqlServerInstanceProperties properties = default(SqlServerInstanceProperties)) + : base(location, id, name, type, systemData, tags) + { + 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs new file mode 100644 index 0000000000000..beb65e4b490ee --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs @@ -0,0 +1,238 @@ +// +// 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', 'Registered', + /// 'Unknown' + /// SQL Server version. Possible values include: + /// 'SQL Server 2012', 'SQL Server 2014', 'SQL Server 2016', 'SQL + /// Server 2017', 'SQL Server 2019', 'SQL Server 2022', + /// 'Unknown' + /// SQL Server edition. Possible values include: + /// 'Evaluation', 'Enterprise', 'Standard', 'Web', 'Developer', + /// 'Express', 'Business Intelligence' + /// The time when the resource was + /// created. + /// The number of logical processors used by the + /// SQL Server instance. + /// The number of total cores of the Operating + /// System Environment (OSE) hosting 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: 'Undefined', 'Free', 'HADR', 'ServerCAL', 'LicenseOnly', + /// 'PAYG', 'Paid' + /// Timestamp of last + /// Azure Defender status update. + /// Status of Azure Defender. + /// Possible values include: 'Protected', 'Unprotected', + /// 'Unknown' + /// The provisioning state of the + /// Arc-enabled SQL Server resource. + /// Type of host for Azure Arc SQL Server. + /// Possible values include: 'Azure Virtual Machine', 'Azure VMWare + /// Virtual Machine', 'Azure Kubernetes Service', 'AWS VMWare Virtual + /// Machine', 'AWS Kubernetes Service', 'GCP VMWare Virtual Machine', + /// 'GCP Kubernetes Service', 'Container', 'Virtual Machine', 'Physical + /// Server', 'AWS Virtual Machine', 'GCP Virtual Machine', + /// 'Other' + public SqlServerInstanceProperties(string containerResourceId, string status, string version = default(string), string edition = default(string), string createTime = default(string), string vCore = default(string), string cores = 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), string hostType = default(string)) + { + Version = version; + Edition = edition; + ContainerResourceId = containerResourceId; + CreateTime = createTime; + VCore = vCore; + Cores = cores; + Status = status; + PatchLevel = patchLevel; + Collation = collation; + CurrentVersion = currentVersion; + InstanceName = instanceName; + TcpDynamicPorts = tcpDynamicPorts; + TcpStaticPorts = tcpStaticPorts; + ProductId = productId; + LicenseType = licenseType; + AzureDefenderStatusLastUpdated = azureDefenderStatusLastUpdated; + AzureDefenderStatus = azureDefenderStatus; + ProvisioningState = provisioningState; + HostType = hostType; + 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 2012', 'SQL Server 2014', 'SQL Server 2016', 'SQL Server + /// 2017', 'SQL Server 2019', 'SQL Server 2022', 'Unknown' + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets SQL Server edition. Possible values include: + /// 'Evaluation', 'Enterprise', 'Standard', 'Web', 'Developer', + /// 'Express', 'Business Intelligence' + /// + [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 number of total cores of the Operating System + /// Environment (OSE) hosting the SQL Server instance. + /// + [JsonProperty(PropertyName = "cores")] + public string Cores { get; set; } + + /// + /// Gets or sets the cloud connectivity status. Possible values + /// include: 'Connected', 'Disconnected', 'Registered', '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: + /// 'Undefined', 'Free', 'HADR', 'ServerCAL', 'LicenseOnly', 'PAYG', + /// 'Paid' + /// + [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; } + + /// + /// Gets the provisioning state of the Arc-enabled SQL Server resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets type of host for Azure Arc SQL Server. Possible values + /// include: 'Azure Virtual Machine', 'Azure VMWare Virtual Machine', + /// 'Azure Kubernetes Service', 'AWS VMWare Virtual Machine', 'AWS + /// Kubernetes Service', 'GCP VMWare Virtual Machine', 'GCP Kubernetes + /// Service', 'Container', 'Virtual Machine', 'Physical Server', 'AWS + /// Virtual Machine', 'GCP Virtual Machine', 'Other' + /// + [JsonProperty(PropertyName = "hostType")] + public string HostType { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs new file mode 100644 index 0000000000000..572595006a850 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs new file mode 100644 index 0000000000000..99eddfef74f86 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs @@ -0,0 +1,27 @@ +// +// 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 SQLServer2012 = "SQL Server 2012"; + public const string SQLServer2014 = "SQL Server 2014"; + public const string SQLServer2016 = "SQL Server 2016"; + public const string SQLServer2017 = "SQL Server 2017"; + public const string SQLServer2019 = "SQL Server 2019"; + public const string SQLServer2022 = "SQL Server 2022"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/State.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/State.cs new file mode 100644 index 0000000000000..817d301f599cd --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/State.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 State. + /// + public static class State + { + public const string Waiting = "Waiting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..21fbeecc52071 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// 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). + /// 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 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 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs new file mode 100644 index 0000000000000..e9ced259c46ad --- /dev/null +++ b/sdk/azurearcdata/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; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + 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. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary)) + : base(id, name, type, systemData) + { + Tags = tags; + Location = location; + 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; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs new file mode 100644 index 0000000000000..d3a83c877158b --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs new file mode 100644 index 0000000000000..f7914d1324342 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs new file mode 100644 index 0000000000000..b693a95ac2306 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..9c52846cf2d80 --- /dev/null +++ b/sdk/azurearcdata/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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperations.cs new file mode 100644 index 0000000000000..328179d7f3152 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperations.cs @@ -0,0 +1,1587 @@ +// +// 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; + + /// + /// PostgresInstancesOperations operations. + /// + internal partial class PostgresInstancesOperations : IServiceOperations, IPostgresInstancesOperations + { + /// + /// Initializes a new instance of the PostgresInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PostgresInstancesOperations(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 postgres Instance 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/postgresInstances").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 postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// 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/postgresInstances").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 postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres 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 postgresInstanceName, 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 (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + 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("postgresInstanceName", postgresInstanceName); + 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/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + 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 postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, resource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters, 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 (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + 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("postgresInstanceName", postgresInstanceName); + 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/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + 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 postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, 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 (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (resource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("postgresInstanceName", postgresInstanceName); + tracingParameters.Add("resource", resource); + 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/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + 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(resource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resource, 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 postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres 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 postgresInstanceName, 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 (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + 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("postgresInstanceName", postgresInstanceName); + 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/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + 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 postgres Instance 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 postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..befd459d81ad2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperationsExtensions.cs @@ -0,0 +1,419 @@ +// +// 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 PostgresInstancesOperations. + /// + public static partial class PostgresInstancesOperationsExtensions + { + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IPostgresInstancesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPostgresInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListByResourceGroup(this IPostgresInstancesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IPostgresInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + public static PostgresInstance Get(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName) + { + return operations.GetAsync(resourceGroupName, postgresInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + public static PostgresInstance Create(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource) + { + return operations.CreateAsync(resourceGroupName, postgresInstanceName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + public static void Delete(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName) + { + operations.DeleteAsync(resourceGroupName, postgresInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres Instance. + /// + public static PostgresInstance Update(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, postgresInstanceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres Instance. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + public static PostgresInstance BeginCreate(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource) + { + return operations.BeginCreateAsync(resourceGroupName, postgresInstanceName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + public static void BeginDelete(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName) + { + operations.BeginDeleteAsync(resourceGroupName, postgresInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List postgres Instance 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 IPostgresInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance 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 IPostgresInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IPostgresInstancesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// 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 IPostgresInstancesOperations 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs new file mode 100644 index 0000000000000..20c2aea117006 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs @@ -0,0 +1,34 @@ + +// +// 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", "ActiveDirectoryConnectors", "2023-01-15-preview"), + new Tuple("AzureArcData", "DataControllers", "2023-01-15-preview"), + new Tuple("AzureArcData", "FailoverGroups", "2023-01-15-preview"), + new Tuple("AzureArcData", "Operations", "2023-01-15-preview"), + new Tuple("AzureArcData", "PostgresInstances", "2023-01-15-preview"), + new Tuple("AzureArcData", "SqlManagedInstances", "2023-01-15-preview"), + new Tuple("AzureArcData", "SqlServerDatabases", "2023-01-15-preview"), + new Tuple("AzureArcData", "SqlServerInstances", "2023-01-15-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs new file mode 100644 index 0000000000000..55fcdde4a4258 --- /dev/null +++ b/sdk/azurearcdata/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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// 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 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..53325b4d15074 --- /dev/null +++ b/sdk/azurearcdata/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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 SQL Managed Instance + /// + /// + /// 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 SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 + /// + /// + /// Name of SQL Managed Instance + /// + 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 + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperations.cs new file mode 100644 index 0000000000000..223864e131918 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperations.cs @@ -0,0 +1,1220 @@ +// +// 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; + + /// + /// SqlServerDatabasesOperations operations. + /// + internal partial class SqlServerDatabasesOperations : IServiceOperations, ISqlServerDatabasesOperations + { + /// + /// Initializes a new instance of the SqlServerDatabasesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SqlServerDatabasesOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// Creates or replaces an Arc Sql Server Database. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The request body for database resource. + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, SqlServerDatabaseResource sqlServerDatabaseResource, string sqlServerInstanceName, string databaseName, 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 (sqlServerDatabaseResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerDatabaseResource"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + 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("sqlServerDatabaseResource", sqlServerDatabaseResource); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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}/databases/{databaseName}").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)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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(sqlServerDatabaseResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlServerDatabaseResource, 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; + } + + /// + /// Deletes an Arc Sql Server database resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, string databaseName, 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 (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + 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("databaseName", databaseName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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}/databases/{databaseName}").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)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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 != 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; + } + + /// + /// Retrieves an Arc Sql Server database. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// 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, string databaseName, 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 (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + 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("databaseName", databaseName); + 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}/databases/{databaseName}").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)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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 an existing database. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// The requested database resource state. + /// + /// + /// 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, string databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, 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 (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (sqlServerDatabaseUpdate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerDatabaseUpdate"); + } + // 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("databaseName", databaseName); + tracingParameters.Add("sqlServerDatabaseUpdate", sqlServerDatabaseUpdate); + 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}/databases/{databaseName}").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)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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(sqlServerDatabaseUpdate != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlServerDatabaseUpdate, 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; + } + + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// 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>> ListWithHttpMessagesAsync(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, "List", 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}/databases").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; + } + + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperationsExtensions.cs new file mode 100644 index 0000000000000..01f8ef43cdacf --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerDatabasesOperationsExtensions.cs @@ -0,0 +1,292 @@ +// +// 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 SqlServerDatabasesOperations. + /// + public static partial class SqlServerDatabasesOperationsExtensions + { + /// + /// Creates or replaces an Arc Sql Server Database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The request body for database resource. + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + public static SqlServerDatabaseResource Create(this ISqlServerDatabasesOperations operations, string resourceGroupName, SqlServerDatabaseResource sqlServerDatabaseResource, string sqlServerInstanceName, string databaseName) + { + return operations.CreateAsync(resourceGroupName, sqlServerDatabaseResource, sqlServerInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces an Arc Sql Server Database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The request body for database resource. + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlServerDatabasesOperations operations, string resourceGroupName, SqlServerDatabaseResource sqlServerDatabaseResource, string sqlServerInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sqlServerDatabaseResource, sqlServerInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Arc Sql Server database resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + public static void Delete(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName, string databaseName) + { + operations.DeleteAsync(resourceGroupName, sqlServerInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Arc Sql Server database resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves an Arc Sql Server database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + public static SqlServerDatabaseResource Get(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName, string databaseName) + { + return operations.GetAsync(resourceGroupName, sqlServerInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves an Arc Sql Server database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// The requested database resource state. + /// + public static SqlServerDatabaseResource Update(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName, string databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) + { + return operations.UpdateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Name of the database + /// + /// + /// The requested database resource state. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName, string databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + public static IPage List(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName) + { + return operations.ListAsync(resourceGroupName, sqlServerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// 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> ListAsync(this ISqlServerDatabasesOperations operations, string resourceGroupName, string sqlServerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISqlServerDatabasesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the databases associated with the given Arc Sql Server. + /// + /// + /// 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 ISqlServerDatabasesOperations 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs new file mode 100644 index 0000000000000..723134a9208d4 --- /dev/null +++ b/sdk/azurearcdata/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 + /// + /// + /// 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 + /// + /// + /// 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 SQL Server Instance + /// + /// + /// 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 + /// + /// + /// 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 + /// + /// + /// 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/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..5beb119c1e2c6 --- /dev/null +++ b/sdk/azurearcdata/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 + /// + /// + /// 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 + /// + /// + /// 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 + /// + /// + /// 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 + /// + /// + /// 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 SQL Server Instance + /// + /// + /// 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 SQL Server Instance + /// + /// + /// 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 + /// + /// + /// 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 + /// + /// + /// 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 + /// + /// + /// 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 + /// + /// + /// 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; + } + } + + } +}