From 2b8638dc3835cf4febbfe59d9133de59275c3d5d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 27 Apr 2022 09:54:28 +0000 Subject: [PATCH] CodeGen from PR 18751 in Azure/azure-rest-api-specs Merge ccf847ca76a24f6b6c179e353acfb50b5a6cda93 into 46ffdc4fe0f9a413ba29ed859b5ff4174ce1c7ec --- .../DistributedAvailabilityGroupCollection.cs | 333 +++++ .../DistributedAvailabilityGroupData.cs | 73 + .../DistributedAvailabilityGroupResource.cs | 249 ++++ .../src/Generated/ElasticPoolCollection.cs | 4 +- .../src/Generated/ElasticPoolData.cs | 6 +- .../EndpointCertificateCollection.cs | 267 ++++ .../src/Generated/EndpointCertificateData.cs | 35 + .../Generated/EndpointCertificateResource.cs | 137 ++ .../ResourceGroupResourceExtensionClient.cs | 44 +- .../src/Generated/Extensions/SqlExtensions.cs | 1216 +++++++++-------- .../SubscriptionResourceExtensionClient.cs | 678 ++++----- .../Generated/IPv6FirewallRuleCollection.cs | 333 +++++ .../src/Generated/IPv6FirewallRuleData.cs | 37 + .../src/Generated/IPv6FirewallRuleResource.cs | 249 ++++ .../src/Generated/InstancePoolResource.cs | 120 +- ...ributedAvailabilityGroupOperationSource.cs | 40 + .../ServerTrustCertificateOperationSource.cs | 40 + .../src/Generated/ManagedInstanceData.cs | 18 +- .../src/Generated/ManagedInstanceResource.cs | 399 ++++-- .../Models/BackupStorageRedundancy.cs | 5 +- .../CopyLongTermRetentionBackupOptions.cs | 2 +- .../Models/CurrentBackupStorageRedundancy.cs | 54 - .../Models/DatabaseIdentity.Serialization.cs | 86 ++ .../src/Generated/Models/DatabaseIdentity.cs | 42 + .../Generated/Models/DatabaseIdentityType.cs | 51 + .../src/Generated/Models/DatabaseReadScale.cs | 2 +- .../src/Generated/Models/DatabaseStatus.cs | 9 + ...utedAvailabilityGroupData.Serialization.cs | 176 +++ ...ilabilityGroupsListResult.Serialization.cs | 47 + ...DistributedAvailabilityGroupsListResult.cs | 37 + .../Models/ElasticPoolData.Serialization.cs | 18 +- .../Models/ElasticPoolPatch.Serialization.cs | 5 + .../src/Generated/Models/ElasticPoolPatch.cs | 2 + ... EndpointCertificateData.Serialization.cs} | 31 +- ...ointCertificateListResult.Serialization.cs | 47 + .../Models/EndpointCertificateListResult.cs | 37 + .../IPv6FirewallRuleData.Serialization.cs | 89 ++ ...v6FirewallRuleListResult.Serialization.cs} | 13 +- ...esult.cs => IPv6FirewallRuleListResult.cs} | 17 +- .../ManagedInstanceData.Serialization.cs | 41 +- .../ManagedInstancePatch.Serialization.cs | 11 +- .../Generated/Models/ManagedInstancePatch.cs | 8 +- ...agedInstancePropertiesProvisioningState.cs | 27 + .../src/Generated/Models/OperationsHealth.cs | 43 - .../src/Generated/Models/ReplicationMode.cs | 51 + .../RequestedBackupStorageRedundancy.cs | 54 - ...orableDroppedDatabaseData.Serialization.cs | 12 +- ...tabasePropertiesBackupStorageRedundancy.cs | 54 - .../src/Generated/Models/SampleName.cs | 54 + ...erverTrustCertificateData.Serialization.cs | 92 ++ ...ustCertificatesListResult.Serialization.cs | 47 + .../ServerTrustCertificatesListResult.cs | 37 + .../Models/ServicePrincipal.Serialization.cs | 63 + .../src/Generated/Models/ServicePrincipal.cs | 40 + .../Generated/Models/ServicePrincipalType.cs | 51 + .../Models/SqlDatabaseData.Serialization.cs | 53 +- .../Models/SqlDatabasePatch.Serialization.cs | 10 + .../src/Generated/Models/SqlDatabasePatch.cs | 16 +- .../Generated/Models/StorageAccountType.cs | 54 - .../Models/TargetBackupStorageRedundancy.cs | 54 - .../UpdateLongTermRetentionBackupOptions.cs | 2 +- .../RestOperations/DatabasesRestOperations.cs | 346 ++--- ...ributedAvailabilityGroupsRestOperations.cs | 530 +++++++ .../ElasticPoolsRestOperations.cs | 12 +- .../EndpointCertificatesRestOperations.cs | 283 ++++ .../IPv6FirewallRulesRestOperations.cs | 452 ++++++ .../LongTermRetentionBackupsRestOperations.cs | 2 +- ...ionManagedInstanceBackupsRestOperations.cs | 2 +- .../ManagedInstancesRestOperations.cs | 2 +- .../OperationsHealthRestOperations.cs | 185 --- ...estorableDroppedDatabasesRestOperations.cs | 2 +- ...leDroppedManagedDatabasesRestOperations.cs | 2 +- .../ServerTrustCertificatesRestOperations.cs | 446 ++++++ .../RestorableDroppedDatabaseData.cs | 8 +- .../ServerTrustCertificateCollection.cs | 333 +++++ .../Generated/ServerTrustCertificateData.cs | 43 + .../ServerTrustCertificateResource.cs | 249 ++++ .../src/Generated/SqlDatabaseData.cs | 54 +- .../src/Generated/SqlDatabaseResource.cs | 936 ++++++------- .../src/Generated/SqlServerResource.cs | 37 + .../Azure.ResourceManager.Sql/src/autorest.md | 2 +- 81 files changed, 7408 insertions(+), 2440 deletions(-) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateData.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleData.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupOperationSource.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateOperationSource.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CurrentBackupStorageRedundancy.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupData.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{OperationsHealth.Serialization.cs => EndpointCertificateData.Serialization.cs} (67%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleData.Serialization.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{OperationsHealthListResult.Serialization.cs => IPv6FirewallRuleListResult.Serialization.cs} (68%) rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{OperationsHealthListResult.cs => IPv6FirewallRuleListResult.cs} (50%) delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationMode.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabasePropertiesBackupStorageRedundancy.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SampleName.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificateData.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageAccountType.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TargetBackupStorageRedundancy.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/EndpointCertificatesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/IPv6FirewallRulesRestOperations.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerTrustCertificatesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateCollection.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateData.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateResource.cs diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs new file mode 100644 index 000000000000..aa12110ded6e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDistributedAvailabilityGroups method from an instance of . + /// + public partial class DistributedAvailabilityGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _distributedAvailabilityGroupClientDiagnostics; + private readonly DistributedAvailabilityGroupsRestOperations _distributedAvailabilityGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected DistributedAvailabilityGroupCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DistributedAvailabilityGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _distributedAvailabilityGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", DistributedAvailabilityGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DistributedAvailabilityGroupResource.ResourceType, out string distributedAvailabilityGroupApiVersion); + _distributedAvailabilityGroupRestClient = new DistributedAvailabilityGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, distributedAvailabilityGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstanceResource.ResourceType), nameof(id)); + } + + /// + /// Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, data, cancellationToken); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a distributed availability group info. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.Get"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a distributed availability group info. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.Get"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of a distributed availability groups in instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups + /// Operation Id: DistributedAvailabilityGroups_ListByInstance + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetAll"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.ListByInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new DistributedAvailabilityGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetAll"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new DistributedAvailabilityGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a list of a distributed availability groups in instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups + /// Operation Id: DistributedAvailabilityGroups_ListByInstance + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetAll"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new DistributedAvailabilityGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetAll"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new DistributedAvailabilityGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.Exists"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs new file mode 100644 index 000000000000..06d9c4fc49fe --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing the DistributedAvailabilityGroup data model. + public partial class DistributedAvailabilityGroupData : ResourceData + { + /// Initializes a new instance of DistributedAvailabilityGroupData. + public DistributedAvailabilityGroupData() + { + } + + /// Initializes a new instance of DistributedAvailabilityGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The name of the target database. + /// The source endpoint. + /// The primary availability group name. + /// The secondary availability group name. + /// The replication mode of a distributed availability group. Parameter will be ignored during link creation. + /// The distributed availability group id. + /// The source replica id. + /// The target replica id. + /// The link state. + /// The last hardened lsn. + internal DistributedAvailabilityGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string targetDatabase, string sourceEndpoint, string primaryAvailabilityGroupName, string secondaryAvailabilityGroupName, ReplicationMode? replicationMode, Guid? distributedAvailabilityGroupId, Guid? sourceReplicaId, Guid? targetReplicaId, string linkState, string lastHardenedLsn) : base(id, name, resourceType, systemData) + { + TargetDatabase = targetDatabase; + SourceEndpoint = sourceEndpoint; + PrimaryAvailabilityGroupName = primaryAvailabilityGroupName; + SecondaryAvailabilityGroupName = secondaryAvailabilityGroupName; + ReplicationMode = replicationMode; + DistributedAvailabilityGroupId = distributedAvailabilityGroupId; + SourceReplicaId = sourceReplicaId; + TargetReplicaId = targetReplicaId; + LinkState = linkState; + LastHardenedLsn = lastHardenedLsn; + } + + /// The name of the target database. + public string TargetDatabase { get; set; } + /// The source endpoint. + public string SourceEndpoint { get; set; } + /// The primary availability group name. + public string PrimaryAvailabilityGroupName { get; set; } + /// The secondary availability group name. + public string SecondaryAvailabilityGroupName { get; set; } + /// The replication mode of a distributed availability group. Parameter will be ignored during link creation. + public ReplicationMode? ReplicationMode { get; set; } + /// The distributed availability group id. + public Guid? DistributedAvailabilityGroupId { get; } + /// The source replica id. + public Guid? SourceReplicaId { get; } + /// The target replica id. + public Guid? TargetReplicaId { get; } + /// The link state. + public string LinkState { get; } + /// The last hardened lsn. + public string LastHardenedLsn { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs new file mode 100644 index 000000000000..a5d0fb1e1b8d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing a DistributedAvailabilityGroup along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDistributedAvailabilityGroupResource method. + /// Otherwise you can get one from its parent resource using the GetDistributedAvailabilityGroup method. + /// + public partial class DistributedAvailabilityGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _distributedAvailabilityGroupClientDiagnostics; + private readonly DistributedAvailabilityGroupsRestOperations _distributedAvailabilityGroupRestClient; + private readonly DistributedAvailabilityGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected DistributedAvailabilityGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DistributedAvailabilityGroupResource(ArmClient client, DistributedAvailabilityGroupData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DistributedAvailabilityGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _distributedAvailabilityGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string distributedAvailabilityGroupApiVersion); + _distributedAvailabilityGroupRestClient = new DistributedAvailabilityGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, distributedAvailabilityGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/managedInstances/distributedAvailabilityGroups"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DistributedAvailabilityGroupData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a distributed availability group info. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Get"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a distributed availability group info. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Get"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Delete"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Delete"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(_distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a distributed availability group replication mode. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Update + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group info. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Update"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a distributed availability group replication mode. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Update + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group info. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Update"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs index 1afe98812f1d..4e52481cfbf5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs @@ -185,7 +185,7 @@ public virtual Response Get(string elasticPoolName, Cancell /// The number of elements in the collection to skip. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(int? skip = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetAllAsync(long? skip = null, CancellationToken cancellationToken = default) { async Task> FirstPageFunc(int? pageSizeHint) { @@ -228,7 +228,7 @@ async Task> NextPageFunc(string nextLink, int? pageSiz /// The number of elements in the collection to skip. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(int? skip = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(long? skip = null, CancellationToken cancellationToken = default) { Page FirstPageFunc(int? pageSizeHint) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolData.cs index 016833416d72..d32f0b61af23 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolData.cs @@ -47,7 +47,8 @@ public ElasticPoolData(AzureLocation location) : base(location) /// Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. /// The license type to apply for this elastic pool. /// Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. - internal ElasticPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, string kind, ElasticPoolState? state, DateTimeOffset? creationOn, long? maxSizeBytes, ElasticPoolPerDatabaseSettings perDatabaseSettings, bool? zoneRedundant, ElasticPoolLicenseType? licenseType, string maintenanceConfigurationId) : base(id, name, resourceType, systemData, tags, location) + /// The number of secondary replicas associated with the elastic pool that are used to provide high availability. + internal ElasticPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, string kind, ElasticPoolState? state, DateTimeOffset? creationOn, long? maxSizeBytes, ElasticPoolPerDatabaseSettings perDatabaseSettings, bool? zoneRedundant, ElasticPoolLicenseType? licenseType, string maintenanceConfigurationId, int? highAvailabilityReplicaCount) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Kind = kind; @@ -58,6 +59,7 @@ internal ElasticPoolData(ResourceIdentifier id, string name, ResourceType resour ZoneRedundant = zoneRedundant; LicenseType = licenseType; MaintenanceConfigurationId = maintenanceConfigurationId; + HighAvailabilityReplicaCount = highAvailabilityReplicaCount; } /// @@ -87,5 +89,7 @@ internal ElasticPoolData(ResourceIdentifier id, string name, ResourceType resour public ElasticPoolLicenseType? LicenseType { get; set; } /// Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. public string MaintenanceConfigurationId { get; set; } + /// The number of secondary replicas associated with the elastic pool that are used to provide high availability. + public int? HighAvailabilityReplicaCount { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs new file mode 100644 index 000000000000..3216e8bff1aa --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetEndpointCertificates method from an instance of . + /// + public partial class EndpointCertificateCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _endpointCertificateClientDiagnostics; + private readonly EndpointCertificatesRestOperations _endpointCertificateRestClient; + + /// Initializes a new instance of the class for mocking. + protected EndpointCertificateCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal EndpointCertificateCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _endpointCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", EndpointCertificateResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(EndpointCertificateResource.ResourceType, out string endpointCertificateApiVersion); + _endpointCertificateRestClient = new EndpointCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, endpointCertificateApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstanceResource.ResourceType), nameof(id)); + } + + /// + /// Gets a certificate used on the endpoint with the given id. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.Get"); + scope.Start(); + try + { + var response = await _endpointCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EndpointCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a certificate used on the endpoint with the given id. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.Get"); + scope.Start(); + try + { + var response = _endpointCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EndpointCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List certificates used on endpoints on the target instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates + /// Operation Id: EndpointCertificates_ListByInstance + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = await _endpointCertificateRestClient.ListByInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new EndpointCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = await _endpointCertificateRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new EndpointCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List certificates used on endpoints on the target instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates + /// Operation Id: EndpointCertificates_ListByInstance + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = _endpointCertificateRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new EndpointCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = _endpointCertificateRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new EndpointCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.Exists"); + scope.Start(); + try + { + var response = await _endpointCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.Exists"); + scope.Start(); + try + { + var response = _endpointCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateData.cs new file mode 100644 index 000000000000..64845a6fe7cc --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateData.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing the EndpointCertificate data model. + public partial class EndpointCertificateData : ResourceData + { + /// Initializes a new instance of EndpointCertificateData. + public EndpointCertificateData() + { + } + + /// Initializes a new instance of EndpointCertificateData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The certificate public blob. + internal EndpointCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string publicBlob) : base(id, name, resourceType, systemData) + { + PublicBlob = publicBlob; + } + + /// The certificate public blob. + public string PublicBlob { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs new file mode 100644 index 000000000000..7bae5b94fbad --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing an EndpointCertificate along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetEndpointCertificateResource method. + /// Otherwise you can get one from its parent resource using the GetEndpointCertificate method. + /// + public partial class EndpointCertificateResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string endpointType) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _endpointCertificateClientDiagnostics; + private readonly EndpointCertificatesRestOperations _endpointCertificateRestClient; + private readonly EndpointCertificateData _data; + + /// Initializes a new instance of the class for mocking. + protected EndpointCertificateResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal EndpointCertificateResource(ArmClient client, EndpointCertificateData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal EndpointCertificateResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _endpointCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string endpointCertificateApiVersion); + _endpointCertificateRestClient = new EndpointCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, endpointCertificateApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/managedInstances/endpointCertificates"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual EndpointCertificateData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a certificate used on the endpoint with the given id. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateResource.Get"); + scope.Start(); + try + { + var response = await _endpointCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EndpointCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a certificate used on the endpoint with the given id. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateResource.Get"); + scope.Start(); + try + { + var response = _endpointCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EndpointCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index d712bbfbede3..0fdc0f74750c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -63,6 +63,28 @@ public virtual InstancePoolCollection GetInstancePools() return GetCachedClient(Client => new InstancePoolCollection(Client, Id)); } + /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. + /// The name of the region where the resource is located. + /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. + public virtual ServerTrustGroupCollection GetServerTrustGroups(string locationName) + { + return new ServerTrustGroupCollection(Client, Id, locationName); + } + + /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. + /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. + public virtual VirtualClusterCollection GetVirtualClusters() + { + return GetCachedClient(Client => new VirtualClusterCollection(Client, Id)); + } + + /// Gets a collection of SqlServerResources in the ResourceGroupResource. + /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. + public virtual SqlServerCollection GetSqlServers() + { + return GetCachedClient(Client => new SqlServerCollection(Client, Id)); + } + /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. /// The location of the database. /// The name of the server. @@ -90,28 +112,6 @@ public virtual ManagedInstanceCollection GetManagedInstances() return GetCachedClient(Client => new ManagedInstanceCollection(Client, Id)); } - /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. - /// The name of the region where the resource is located. - /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. - public virtual ServerTrustGroupCollection GetServerTrustGroups(string locationName) - { - return new ServerTrustGroupCollection(Client, Id, locationName); - } - - /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. - /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. - public virtual VirtualClusterCollection GetVirtualClusters() - { - return GetCachedClient(Client => new VirtualClusterCollection(Client, Id)); - } - - /// Gets a collection of SqlServerResources in the ResourceGroupResource. - /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. - public virtual SqlServerCollection GetSqlServers() - { - return GetCachedClient(Client => new SqlServerCollection(Client, Id)); - } - /// /// Lists the long term retention backups for a given location. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs index 7022aea780d8..ed06cd8b5666 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -76,6 +76,100 @@ public static Response GetDeletedServer(this Subscription return subscriptionResource.GetDeletedServers(locationName).Get(deletedServerName, cancellationToken); } + /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. + public static SubscriptionUsageCollection GetSubscriptionUsages(this SubscriptionResource subscriptionResource, string locationName) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetSubscriptionUsages(locationName); + } + + /// + /// Gets a subscription usage metric. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// Operation Id: SubscriptionUsages_Get + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// Name of usage metric to return. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetSubscriptionUsageAsync(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) + { + return await subscriptionResource.GetSubscriptionUsages(locationName).GetAsync(usageName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a subscription usage metric. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// Operation Id: SubscriptionUsages_Get + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// Name of usage metric to return. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetSubscriptionUsage(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) + { + return subscriptionResource.GetSubscriptionUsages(locationName).Get(usageName, cancellationToken); + } + + /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. + /// The instance the method will execute against. + /// The String to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. + public static SqlTimeZoneCollection GetSqlTimeZones(this SubscriptionResource subscriptionResource, string locationName) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetSqlTimeZones(locationName); + } + + /// + /// Gets a managed instance time zone. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// Operation Id: TimeZones_Get + /// + /// The instance the method will execute against. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetSqlTimeZoneAsync(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + return await subscriptionResource.GetSqlTimeZones(locationName).GetAsync(timeZoneId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed instance time zone. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// Operation Id: TimeZones_Get + /// + /// The instance the method will execute against. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetSqlTimeZone(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + return subscriptionResource.GetSqlTimeZones(locationName).Get(timeZoneId, cancellationToken); + } + /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. /// The instance the method will execute against. /// The location of the database. @@ -186,100 +280,6 @@ public static Response Gets a collection of SubscriptionUsageResources in the SubscriptionResource. - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. - public static SubscriptionUsageCollection GetSubscriptionUsages(this SubscriptionResource subscriptionResource, string locationName) - { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSubscriptionUsages(locationName); - } - - /// - /// Gets a subscription usage metric. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} - /// Operation Id: SubscriptionUsages_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// Name of usage metric to return. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static async Task> GetSubscriptionUsageAsync(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) - { - return await subscriptionResource.GetSubscriptionUsages(locationName).GetAsync(usageName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a subscription usage metric. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} - /// Operation Id: SubscriptionUsages_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// Name of usage metric to return. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static Response GetSubscriptionUsage(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) - { - return subscriptionResource.GetSubscriptionUsages(locationName).Get(usageName, cancellationToken); - } - - /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. - /// The instance the method will execute against. - /// The String to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. - public static SqlTimeZoneCollection GetSqlTimeZones(this SubscriptionResource subscriptionResource, string locationName) - { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSqlTimeZones(locationName); - } - - /// - /// Gets a managed instance time zone. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} - /// Operation Id: TimeZones_Get - /// - /// The instance the method will execute against. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static async Task> GetSqlTimeZoneAsync(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) - { - return await subscriptionResource.GetSqlTimeZones(locationName).GetAsync(timeZoneId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a managed instance time zone. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} - /// Operation Id: TimeZones_Get - /// - /// The instance the method will execute against. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static Response GetSqlTimeZone(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) - { - return subscriptionResource.GetSqlTimeZones(locationName).Get(timeZoneId, cancellationToken); - } - /// /// Gets a list of all deleted servers in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers @@ -369,83 +369,205 @@ public static Response GetByLocationCapability(this Subscr } /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds /// /// The instance the method will execute against. - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the region where the resource is located. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetLongTermRetentionBackupsByLocationAsync(this SubscriptionResource subscriptionResource, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - return GetExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); } /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds /// /// The instance the method will execute against. - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the region where the resource is located. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetLongTermRetentionBackupsByLocation(this SubscriptionResource subscriptionResource, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSyncDatabaseIdsSyncGroups(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - return GetExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); } /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List /// /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetLongTermRetentionBackupsByServerAsync(this SubscriptionResource subscriptionResource, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetVirtualClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetExtensionClient(subscriptionResource).GetVirtualClustersAsync(cancellationToken); } /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List /// /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetLongTermRetentionBackupsByServer(this SubscriptionResource subscriptionResource, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetVirtualClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetVirtualClusters(cancellationToken); + } + + /// + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List + /// + /// The instance the method will execute against. + /// The child resources to include in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSqlServersAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetSqlServersAsync(expand, cancellationToken); + } + + /// + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List + /// + /// The instance the method will execute against. + /// The child resources to include in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSqlServers(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetSqlServers(expand, cancellationToken); + } + + /// + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability + /// + /// The instance the method will execute against. + /// The name availability request parameters. + /// The cancellation token to use. + /// is null. + public static async Task> CheckNameAvailabilityServerAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + return await GetExtensionClient(subscriptionResource).CheckNameAvailabilityServerAsync(content, cancellationToken).ConfigureAwait(false); + } + + /// + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability + /// + /// The instance the method will execute against. + /// The name availability request parameters. + /// The cancellation token to use. + /// is null. + public static Response CheckNameAvailabilityServer(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + return GetExtensionClient(subscriptionResource).CheckNameAvailabilityServer(content, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation + /// + /// The instance the method will execute against. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetLongTermRetentionBackupsByLocationAsync(this SubscriptionResource subscriptionResource, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation + /// + /// The instance the method will execute against. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetLongTermRetentionBackupsByLocation(this SubscriptionResource subscriptionResource, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer + /// + /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetLongTermRetentionBackupsByServerAsync(this SubscriptionResource subscriptionResource, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + return GetExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer + /// + /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetLongTermRetentionBackupsByServer(this SubscriptionResource subscriptionResource, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); @@ -564,258 +686,229 @@ public static Pageable GetManagedInstances(this Subscri return GetExtensionClient(subscriptionResource).GetManagedInstances(expand, cancellationToken); } - /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetOperationsHealthsByLocationAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetOperationsHealthsByLocationAsync(locationName, cancellationToken); + return resourceGroupResource.GetCachedClient((client) => + { + return new ResourceGroupResourceExtensionClient(client, resourceGroupResource.Id); + } + ); } - /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation - /// - /// The instance the method will execute against. + /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. + /// The instance the method will execute against. /// The name of the region where the resource is located. - /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetOperationsHealthsByLocation(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + /// An object representing collection of InstanceFailoverGroupResources and their operations over a InstanceFailoverGroupResource. + public static InstanceFailoverGroupCollection GetInstanceFailoverGroups(this ResourceGroupResource resourceGroupResource, string locationName) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - return GetExtensionClient(subscriptionResource).GetOperationsHealthsByLocation(locationName, cancellationToken); + return GetExtensionClient(resourceGroupResource).GetInstanceFailoverGroups(locationName); } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Gets a failover group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// Operation Id: InstanceFailoverGroups_Get /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The name of the region where the resource is located. + /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetInstanceFailoverGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); + return await resourceGroupResource.GetInstanceFailoverGroups(locationName).GetAsync(failoverGroupName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Gets a failover group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// Operation Id: InstanceFailoverGroups_Get /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The name of the region where the resource is located. + /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetSyncDatabaseIdsSyncGroups(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetInstanceFailoverGroup(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); + return resourceGroupResource.GetInstanceFailoverGroups(locationName).Get(failoverGroupName, cancellationToken); } - /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List - /// - /// The instance the method will execute against. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetVirtualClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) { - return GetExtensionClient(subscriptionResource).GetVirtualClustersAsync(cancellationToken); + return GetExtensionClient(resourceGroupResource).GetInstancePools(); } /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List + /// Gets an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// Operation Id: InstancePools_Get /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetVirtualClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionResource).GetVirtualClusters(cancellationToken); + return await resourceGroupResource.GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List + /// Gets an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// Operation Id: InstancePools_Get /// - /// The instance the method will execute against. - /// The child resources to include in the response. + /// The instance the method will execute against. + /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetSqlServersAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionResource).GetSqlServersAsync(expand, cancellationToken); + return resourceGroupResource.GetInstancePools().Get(instancePoolName, cancellationToken); } - /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List - /// - /// The instance the method will execute against. - /// The child resources to include in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetSqlServers(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. + public static ServerTrustGroupCollection GetServerTrustGroups(this ResourceGroupResource resourceGroupResource, string locationName) { - return GetExtensionClient(subscriptionResource).GetSqlServers(expand, cancellationToken); + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(resourceGroupResource).GetServerTrustGroups(locationName); } /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability + /// Gets a server trust group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// Operation Id: ServerTrustGroups_Get /// - /// The instance the method will execute against. - /// The name availability request parameters. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The name of the server trust group. /// The cancellation token to use. - /// is null. - public static async Task> CheckNameAvailabilityServerAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetServerTrustGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetExtensionClient(subscriptionResource).CheckNameAvailabilityServerAsync(content, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetServerTrustGroups(locationName).GetAsync(serverTrustGroupName, cancellationToken).ConfigureAwait(false); } /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability + /// Gets a server trust group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// Operation Id: ServerTrustGroups_Get /// - /// The instance the method will execute against. - /// The name availability request parameters. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The name of the server trust group. /// The cancellation token to use. - /// is null. - public static Response CheckNameAvailabilityServer(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - return GetExtensionClient(subscriptionResource).CheckNameAvailabilityServer(content, cancellationToken); - } - - private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetServerTrustGroup(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCachedClient((client) => - { - return new ResourceGroupResourceExtensionClient(client, resourceGroupResource.Id); - } - ); + return resourceGroupResource.GetServerTrustGroups(locationName).Get(serverTrustGroupName, cancellationToken); } - /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. + /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of InstanceFailoverGroupResources and their operations over a InstanceFailoverGroupResource. - public static InstanceFailoverGroupCollection GetInstanceFailoverGroups(this ResourceGroupResource resourceGroupResource, string locationName) + /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. + public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupResource resourceGroupResource) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(resourceGroupResource).GetInstanceFailoverGroups(locationName); + return GetExtensionClient(resourceGroupResource).GetVirtualClusters(); } /// - /// Gets a failover group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} - /// Operation Id: InstanceFailoverGroups_Get + /// Gets a virtual cluster. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} + /// Operation Id: VirtualClusters_Get /// /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the failover group. + /// The name of the virtual cluster. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static async Task> GetInstanceFailoverGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) + public static async Task> GetVirtualClusterAsync(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetInstanceFailoverGroups(locationName).GetAsync(failoverGroupName, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetVirtualClusters().GetAsync(virtualClusterName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a failover group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} - /// Operation Id: InstanceFailoverGroups_Get + /// Gets a virtual cluster. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} + /// Operation Id: VirtualClusters_Get /// /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the failover group. + /// The name of the virtual cluster. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static Response GetInstanceFailoverGroup(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) + public static Response GetVirtualCluster(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetInstanceFailoverGroups(locationName).Get(failoverGroupName, cancellationToken); + return resourceGroupResource.GetVirtualClusters().Get(virtualClusterName, cancellationToken); } - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// Gets a collection of SqlServerResources in the ResourceGroupResource. /// The instance the method will execute against. - /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. - public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. + public static SqlServerCollection GetSqlServers(this ResourceGroupResource resourceGroupResource) { - return GetExtensionClient(resourceGroupResource).GetInstancePools(); + return GetExtensionClient(resourceGroupResource).GetSqlServers(); } /// - /// Gets an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// Operation Id: InstancePools_Get + /// Gets a server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// Operation Id: Servers_Get /// /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. + /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + public static async Task> GetSqlServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetSqlServers().GetAsync(serverName, expand, cancellationToken).ConfigureAwait(false); } /// - /// Gets an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// Operation Id: InstancePools_Get + /// Gets a server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// Operation Id: Servers_Get /// /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. + /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + public static Response GetSqlServer(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetInstancePools().Get(instancePoolName, cancellationToken); + return resourceGroupResource.GetSqlServers().Get(serverName, expand, cancellationToken); } /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. @@ -970,135 +1063,6 @@ public static Response GetManagedInstance(this Resource return resourceGroupResource.GetManagedInstances().Get(managedInstanceName, expand, cancellationToken); } - /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. - public static ServerTrustGroupCollection GetServerTrustGroups(this ResourceGroupResource resourceGroupResource, string locationName) - { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(resourceGroupResource).GetServerTrustGroups(locationName); - } - - /// - /// Gets a server trust group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} - /// Operation Id: ServerTrustGroups_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the server trust group. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static async Task> GetServerTrustGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) - { - return await resourceGroupResource.GetServerTrustGroups(locationName).GetAsync(serverTrustGroupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a server trust group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} - /// Operation Id: ServerTrustGroups_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the server trust group. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static Response GetServerTrustGroup(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) - { - return resourceGroupResource.GetServerTrustGroups(locationName).Get(serverTrustGroupName, cancellationToken); - } - - /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. - /// The instance the method will execute against. - /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. - public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupResource resourceGroupResource) - { - return GetExtensionClient(resourceGroupResource).GetVirtualClusters(); - } - - /// - /// Gets a virtual cluster. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} - /// Operation Id: VirtualClusters_Get - /// - /// The instance the method will execute against. - /// The name of the virtual cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetVirtualClusterAsync(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) - { - return await resourceGroupResource.GetVirtualClusters().GetAsync(virtualClusterName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a virtual cluster. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} - /// Operation Id: VirtualClusters_Get - /// - /// The instance the method will execute against. - /// The name of the virtual cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetVirtualCluster(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) - { - return resourceGroupResource.GetVirtualClusters().Get(virtualClusterName, cancellationToken); - } - - /// Gets a collection of SqlServerResources in the ResourceGroupResource. - /// The instance the method will execute against. - /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. - public static SqlServerCollection GetSqlServers(this ResourceGroupResource resourceGroupResource) - { - return GetExtensionClient(resourceGroupResource).GetSqlServers(); - } - - /// - /// Gets a server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} - /// Operation Id: Servers_Get - /// - /// The instance the method will execute against. - /// The name of the server. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetSqlServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) - { - return await resourceGroupResource.GetSqlServers().GetAsync(serverName, expand, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} - /// Operation Id: Servers_Get - /// - /// The instance the method will execute against. - /// The name of the server. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetSqlServer(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) - { - return resourceGroupResource.GetSqlServers().Get(serverName, expand, cancellationToken); - } - /// /// Lists the long term retention backups for a given location. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups @@ -2141,82 +2105,6 @@ public static JobVersionResource GetJobVersionResource(this ArmClient client, Re } #endregion - #region SubscriptionLongTermRetentionBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); - return new SubscriptionLongTermRetentionBackupResource(client, id); - } - ); - } - #endregion - - #region ResourceGroupLongTermRetentionBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionBackupResource(client, id); - } - ); - } - #endregion - - #region SubscriptionLongTermRetentionManagedInstanceBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionLongTermRetentionManagedInstanceBackupResource GetSubscriptionLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - SubscriptionLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); - return new SubscriptionLongTermRetentionManagedInstanceBackupResource(client, id); - } - ); - } - #endregion - - #region ResourceGroupLongTermRetentionManagedInstanceBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupLongTermRetentionManagedInstanceBackupResource GetResourceGroupLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ResourceGroupLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionManagedInstanceBackupResource(client, id); - } - ); - } - #endregion - #region LongTermRetentionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -2331,77 +2219,39 @@ public static ManagedDatabaseRestoreDetailsResultResource GetManagedDatabaseRest } #endregion - #region ManagedDatabaseResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedDatabaseResource GetManagedDatabaseResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedDatabaseResource.ValidateResourceId(id); - return new ManagedDatabaseResource(client, id); - } - ); - } - #endregion - - #region ManagedDatabaseSecurityAlertPolicyResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedDatabaseSecurityAlertPolicyResource GetManagedDatabaseSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedDatabaseSecurityAlertPolicyResource.ValidateResourceId(id); - return new ManagedDatabaseSecurityAlertPolicyResource(client, id); - } - ); - } - #endregion - - #region ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource + #region ManagedDatabaseResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource GetManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ManagedDatabaseResource GetManagedDatabaseResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); - return new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(client, id); + ManagedDatabaseResource.ValidateResourceId(id); + return new ManagedDatabaseResource(client, id); } ); } #endregion - #region ServerDatabaseSchemaTableColumnSensitivityLabelResource + #region ManagedDatabaseSecurityAlertPolicyResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ServerDatabaseSchemaTableColumnSensitivityLabelResource GetServerDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ManagedDatabaseSecurityAlertPolicyResource GetManagedDatabaseSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ServerDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); - return new ServerDatabaseSchemaTableColumnSensitivityLabelResource(client, id); + ManagedDatabaseSecurityAlertPolicyResource.ValidateResourceId(id); + return new ManagedDatabaseSecurityAlertPolicyResource(client, id); } ); } @@ -2578,25 +2428,6 @@ public static ManagedInstancePrivateLinkResource GetManagedInstancePrivateLinkRe } #endregion - #region ManagedInstanceResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedInstanceResource GetManagedInstanceResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedInstanceResource.ValidateResourceId(id); - return new ManagedInstanceResource(client, id); - } - ); - } - #endregion - #region ManagedInstanceVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -3148,6 +2979,120 @@ public static OutboundFirewallRuleResource GetOutboundFirewallRuleResource(this } #endregion + #region SqlServerResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SqlServerResource GetSqlServerResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SqlServerResource.ValidateResourceId(id); + return new SqlServerResource(client, id); + } + ); + } + #endregion + + #region SubscriptionLongTermRetentionBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); + return new SubscriptionLongTermRetentionBackupResource(client, id); + } + ); + } + #endregion + + #region ResourceGroupLongTermRetentionBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionBackupResource(client, id); + } + ); + } + #endregion + + #region SubscriptionLongTermRetentionManagedInstanceBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionLongTermRetentionManagedInstanceBackupResource GetSubscriptionLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SubscriptionLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); + return new SubscriptionLongTermRetentionManagedInstanceBackupResource(client, id); + } + ); + } + #endregion + + #region ResourceGroupLongTermRetentionManagedInstanceBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGroupLongTermRetentionManagedInstanceBackupResource GetResourceGroupLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ResourceGroupLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionManagedInstanceBackupResource(client, id); + } + ); + } + #endregion + + #region ManagedInstanceResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedInstanceResource GetManagedInstanceResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedInstanceResource.ValidateResourceId(id); + return new ManagedInstanceResource(client, id); + } + ); + } + #endregion + #region RestorableDroppedDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -3186,39 +3131,134 @@ public static RestorableDroppedManagedDatabaseResource GetRestorableDroppedManag } #endregion - #region SqlServerResource + #region ServerConnectionPolicyResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SqlServerResource GetSqlServerResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServerConnectionPolicyResource GetServerConnectionPolicyResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - SqlServerResource.ValidateResourceId(id); - return new SqlServerResource(client, id); + ServerConnectionPolicyResource.ValidateResourceId(id); + return new ServerConnectionPolicyResource(client, id); } ); } #endregion - #region ServerConnectionPolicyResource + #region DistributedAvailabilityGroupResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ServerConnectionPolicyResource GetServerConnectionPolicyResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ServerConnectionPolicyResource.ValidateResourceId(id); - return new ServerConnectionPolicyResource(client, id); + DistributedAvailabilityGroupResource.ValidateResourceId(id); + return new DistributedAvailabilityGroupResource(client, id); + } + ); + } + #endregion + + #region ServerTrustCertificateResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServerTrustCertificateResource GetServerTrustCertificateResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServerTrustCertificateResource.ValidateResourceId(id); + return new ServerTrustCertificateResource(client, id); + } + ); + } + #endregion + + #region IPv6FirewallRuleResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static IPv6FirewallRuleResource GetIPv6FirewallRuleResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + IPv6FirewallRuleResource.ValidateResourceId(id); + return new IPv6FirewallRuleResource(client, id); + } + ); + } + #endregion + + #region EndpointCertificateResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static EndpointCertificateResource GetEndpointCertificateResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + EndpointCertificateResource.ValidateResourceId(id); + return new EndpointCertificateResource(client, id); + } + ); + } + #endregion + + #region ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource GetManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); + return new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(client, id); + } + ); + } + #endregion + + #region ServerDatabaseSchemaTableColumnSensitivityLabelResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServerDatabaseSchemaTableColumnSensitivityLabelResource GetServerDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServerDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); + return new ServerDatabaseSchemaTableColumnSensitivityLabelResource(client, id); } ); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 74e8eb8c386b..42e299daec05 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -27,20 +27,18 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private InstancePoolsRestOperations _instancePoolRestClient; private ClientDiagnostics _capabilitiesClientDiagnostics; private CapabilitiesRestOperations _capabilitiesRestClient; - private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; - private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; - private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; - private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; - private ClientDiagnostics _managedInstanceClientDiagnostics; - private ManagedInstancesRestOperations _managedInstanceRestClient; - private ClientDiagnostics _operationsHealthClientDiagnostics; - private OperationsHealthRestOperations _operationsHealthRestClient; private ClientDiagnostics _syncGroupClientDiagnostics; private SyncGroupsRestOperations _syncGroupRestClient; private ClientDiagnostics _virtualClusterClientDiagnostics; private VirtualClustersRestOperations _virtualClusterRestClient; private ClientDiagnostics _sqlServerServersClientDiagnostics; private ServersRestOperations _sqlServerServersRestClient; + private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; + private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; + private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; + private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; + private ClientDiagnostics _managedInstanceClientDiagnostics; + private ManagedInstancesRestOperations _managedInstanceRestClient; /// Initializes a new instance of the class for mocking. protected SubscriptionResourceExtensionClient() @@ -60,20 +58,18 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); private ClientDiagnostics CapabilitiesClientDiagnostics => _capabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); private CapabilitiesRestOperations CapabilitiesRestClient => _capabilitiesRestClient ??= new CapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); - private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); - private ClientDiagnostics OperationsHealthClientDiagnostics => _operationsHealthClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OperationsHealthRestOperations OperationsHealthRestClient => _operationsHealthRestClient ??= new OperationsHealthRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics SyncGroupClientDiagnostics => _syncGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SyncGroupResource.ResourceType.Namespace, Diagnostics); private SyncGroupsRestOperations SyncGroupRestClient => _syncGroupRestClient ??= new SyncGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SyncGroupResource.ResourceType)); private ClientDiagnostics VirtualClusterClientDiagnostics => _virtualClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", VirtualClusterResource.ResourceType.Namespace, Diagnostics); private VirtualClustersRestOperations VirtualClusterRestClient => _virtualClusterRestClient ??= new VirtualClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualClusterResource.ResourceType)); private ClientDiagnostics SqlServerServersClientDiagnostics => _sqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerResource.ResourceType.Namespace, Diagnostics); private ServersRestOperations SqlServerServersRestClient => _sqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlServerResource.ResourceType)); + private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); + private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -89,6 +85,22 @@ public virtual DeletedServerCollection GetDeletedServers(string locationName) return new DeletedServerCollection(Client, Id, locationName); } + /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. + /// The name of the region where the resource is located. + /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. + public virtual SubscriptionUsageCollection GetSubscriptionUsages(string locationName) + { + return new SubscriptionUsageCollection(Client, Id, locationName); + } + + /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. + /// The String to use. + /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. + public virtual SqlTimeZoneCollection GetSqlTimeZones(string locationName) + { + return new SqlTimeZoneCollection(Client, Id, locationName); + } + /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. /// The location of the database. /// The name of the server. @@ -109,22 +121,6 @@ public virtual SubscriptionLongTermRetentionManagedInstanceBackupCollection GetS return new SubscriptionLongTermRetentionManagedInstanceBackupCollection(Client, Id, locationName, managedInstanceName, databaseName); } - /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. - /// The name of the region where the resource is located. - /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. - public virtual SubscriptionUsageCollection GetSubscriptionUsages(string locationName) - { - return new SubscriptionUsageCollection(Client, Id, locationName); - } - - /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. - /// The String to use. - /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. - public virtual SqlTimeZoneCollection GetSqlTimeZones(string locationName) - { - return new SqlTimeZoneCollection(Client, Id, locationName); - } - /// /// Gets a list of all deleted servers in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers @@ -342,25 +338,23 @@ public virtual Response GetByLocationCapability(string loc } /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the region where the resource is located. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(string locationName, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SyncGroupRestClient.ListSyncDatabaseIdsAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -368,14 +362,14 @@ async Task> FirstPageFunc(int? throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SyncGroupRestClient.ListSyncDatabaseIdsNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -387,25 +381,23 @@ async Task> NextPageFunc(strin } /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the region where the resource is located. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSyncDatabaseIdsSyncGroups(string locationName, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SyncGroupRestClient.ListSyncDatabaseIds(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -413,14 +405,14 @@ Page FirstPageFunc(int? pageSizeHin throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SyncGroupRestClient.ListSyncDatabaseIdsNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -432,26 +424,22 @@ Page NextPageFunc(string nextLink, } /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualClustersAsync(CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByServerAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await VirtualClusterRestClient.ListAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -459,14 +447,14 @@ async Task> FirstPageFunc(int? throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await VirtualClusterRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -478,26 +466,22 @@ async Task> NextPageFunc(strin } /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualClusters(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = VirtualClusterRestClient.List(Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -505,14 +489,14 @@ Page FirstPageFunc(int? pageSizeHin throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = VirtualClusterRestClient.ListNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -524,26 +508,23 @@ Page NextPageFunc(string nextLink, } /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The child resources to include in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSqlServersAsync(string expand = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceAsync(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SqlServerServersRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -551,14 +532,14 @@ async Task> Fir throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SqlServerServersRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -570,26 +551,23 @@ async Task> Nex } /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The child resources to include in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByInstance(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSqlServers(string expand = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SqlServerServersRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -597,14 +575,14 @@ Page FirstPageFunc(i throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SqlServerServersRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -616,113 +594,71 @@ Page NextPageFunc(st } /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name availability request parameters. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + public virtual async Task> CheckNameAvailabilityServerAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityServer"); + scope.Start(); + try { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + catch (Exception e) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + scope.Failed(e); + throw; } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name availability request parameters. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + public virtual Response CheckNameAvailabilityServer(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityServer"); + scope.Start(); + try { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = SqlServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; } - Page NextPageFunc(string nextLink, int? pageSizeHint) + catch (Exception e) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + scope.Failed(e); + throw; } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// - /// Gets a list of all managed instances in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// Operation Id: ManagedInstances_List + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation /// - /// The child resources to include in the response. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = await ManagedInstanceRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -730,14 +666,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = await ManagedInstanceRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -749,23 +685,25 @@ async Task> NextPageFunc(string nextLink, int? pag } /// - /// Gets a list of all managed instances in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// Operation Id: ManagedInstances_List + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation /// - /// The child resources to include in the response. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = ManagedInstanceRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -773,14 +711,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = ManagedInstanceRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -792,23 +730,26 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsHealthsByLocationAsync(string locationName, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = await OperationsHealthRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByServerAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -816,14 +757,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = await OperationsHealthRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -835,23 +776,26 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi } /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationsHealthsByLocation(string locationName, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = OperationsHealthRestClient.ListByLocation(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -859,14 +803,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = OperationsHealthRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -878,23 +822,26 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(string locationName, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = await SyncGroupRestClient.ListSyncDatabaseIdsAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceAsync(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -902,14 +849,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = await SyncGroupRestClient.ListSyncDatabaseIdsNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -921,23 +868,26 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSyncDatabaseIdsSyncGroups(string locationName, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByInstance(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = SyncGroupRestClient.ListSyncDatabaseIds(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -945,14 +895,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = SyncGroupRestClient.ListSyncDatabaseIdsNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -964,22 +914,25 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualClustersAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = await VirtualClusterRestClient.ListAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -987,14 +940,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = await VirtualClusterRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1006,22 +959,25 @@ async Task> NextPageFunc(string nextLink, int? page } /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualClusters(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = VirtualClusterRestClient.List(Id.SubscriptionId, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1029,14 +985,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = VirtualClusterRestClient.ListNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1048,23 +1004,23 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List + /// Gets a list of all managed instances in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// Operation Id: ManagedInstances_List /// /// The child resources to include in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSqlServersAsync(string expand = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = await SqlServerServersRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await ManagedInstanceRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1072,14 +1028,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = await SqlServerServersRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await ManagedInstanceRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1091,23 +1047,23 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH } /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List + /// Gets a list of all managed instances in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// Operation Id: ManagedInstances_List /// /// The child resources to include in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSqlServers(string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = SqlServerServersRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = ManagedInstanceRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1115,14 +1071,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = SqlServerServersRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = ManagedInstanceRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1132,51 +1088,5 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - - /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability - /// - /// The name availability request parameters. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilityServerAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityServer"); - scope.Start(); - try - { - var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability - /// - /// The name availability request parameters. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilityServer(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityServer"); - scope.Start(); - try - { - var response = SqlServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs new file mode 100644 index 000000000000..7004e088ff5e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetIPv6FirewallRules method from an instance of . + /// + public partial class IPv6FirewallRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _iPv6FirewallRuleClientDiagnostics; + private readonly IPv6FirewallRulesRestOperations _iPv6FirewallRuleRestClient; + + /// Initializes a new instance of the class for mocking. + protected IPv6FirewallRuleCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal IPv6FirewallRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _iPv6FirewallRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", IPv6FirewallRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(IPv6FirewallRuleResource.ResourceType, out string iPv6FirewallRuleApiVersion); + _iPv6FirewallRuleRestClient = new IPv6FirewallRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, iPv6FirewallRuleApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SqlServerResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SqlServerResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the firewall rule. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string firewallRuleName, IPv6FirewallRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(Response.FromValue(new IPv6FirewallRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the firewall rule. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string firewallRuleName, IPv6FirewallRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, data, cancellationToken); + var operation = new SqlArmOperation(Response.FromValue(new IPv6FirewallRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.Get"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.Get"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of IPv6 firewall rules. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules + /// Operation Id: IPv6FirewallRules_ListByServer + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetAll"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.ListByServerAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new IPv6FirewallRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetAll"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new IPv6FirewallRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a list of IPv6 firewall rules. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules + /// Operation Id: IPv6FirewallRules_ListByServer + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetAll"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.ListByServer(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new IPv6FirewallRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetAll"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new IPv6FirewallRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.Exists"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.Exists"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleData.cs new file mode 100644 index 000000000000..8bdb3f276b1c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleData.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing the IPv6FirewallRule data model. + public partial class IPv6FirewallRuleData : ProxyResourceWithWritableName + { + /// Initializes a new instance of IPv6FirewallRuleData. + public IPv6FirewallRuleData() + { + } + + /// Initializes a new instance of IPv6FirewallRuleData. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The start IP address of the firewall rule. Must be IPv6 format. + /// The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpAddress. + internal IPv6FirewallRuleData(string id, string name, string resourceType, string startIPv6Address, string endIPv6Address) : base(id, name, resourceType) + { + StartIPv6Address = startIPv6Address; + EndIPv6Address = endIPv6Address; + } + + /// The start IP address of the firewall rule. Must be IPv6 format. + public string StartIPv6Address { get; set; } + /// The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpAddress. + public string EndIPv6Address { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs new file mode 100644 index 000000000000..993265e568c8 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing an IPv6FirewallRule along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetIPv6FirewallRuleResource method. + /// Otherwise you can get one from its parent resource using the GetIPv6FirewallRule method. + /// + public partial class IPv6FirewallRuleResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _iPv6FirewallRuleClientDiagnostics; + private readonly IPv6FirewallRulesRestOperations _iPv6FirewallRuleRestClient; + private readonly IPv6FirewallRuleData _data; + + /// Initializes a new instance of the class for mocking. + protected IPv6FirewallRuleResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal IPv6FirewallRuleResource(ArmClient client, IPv6FirewallRuleData data) : this(client, new ResourceIdentifier(data.Id)) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal IPv6FirewallRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _iPv6FirewallRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string iPv6FirewallRuleApiVersion); + _iPv6FirewallRuleRestClient = new IPv6FirewallRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, iPv6FirewallRuleApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/servers/ipv6FirewallRules"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual IPv6FirewallRuleData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleResource.Get"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleResource.Get"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleResource.Delete"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleResource.Delete"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, IPv6FirewallRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleResource.Update"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(Response.FromValue(new IPv6FirewallRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, IPv6FirewallRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleResource.Update"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new SqlArmOperation(Response.FromValue(new IPv6FirewallRuleResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs index a0808983276b..eea391b85b6e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs @@ -37,10 +37,10 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _instancePoolClientDiagnostics; private readonly InstancePoolsRestOperations _instancePoolRestClient; - private readonly ClientDiagnostics _managedInstanceClientDiagnostics; - private readonly ManagedInstancesRestOperations _managedInstanceRestClient; private readonly ClientDiagnostics _usagesClientDiagnostics; private readonly UsagesRestOperations _usagesRestClient; + private readonly ClientDiagnostics _managedInstanceClientDiagnostics; + private readonly ManagedInstancesRestOperations _managedInstanceRestClient; private readonly InstancePoolData _data; /// Initializes a new instance of the class for mocking. @@ -65,11 +65,11 @@ internal InstancePoolResource(ArmClient client, ResourceIdentifier id) : base(cl _instancePoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string instancePoolApiVersion); _instancePoolRestClient = new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, instancePoolApiVersion); + _usagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _usagesRestClient = new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _managedInstanceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(ManagedInstanceResource.ResourceType, out string managedInstanceApiVersion); _managedInstanceRestClient = new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedInstanceApiVersion); - _usagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _usagesRestClient = new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -260,23 +260,23 @@ public virtual ArmOperation Update(WaitUntil waitUntil, In } /// - /// Gets a list of all managed instances in an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances - /// Operation Id: ManagedInstances_ListByInstancePool + /// Gets all instance pool usage metrics + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages + /// Operation Id: Usages_ListByInstancePool /// - /// The child resources to include in the response. + /// Optional request parameter to include managed instance usages within the instance pool. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(bool? expandChildren = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = await _managedInstanceRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _usagesRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -284,14 +284,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = await _managedInstanceRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _usagesRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -303,23 +303,23 @@ async Task> NextPageFunc(string nextLink, int? pag } /// - /// Gets a list of all managed instances in an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances - /// Operation Id: ManagedInstances_ListByInstancePool + /// Gets all instance pool usage metrics + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages + /// Operation Id: Usages_ListByInstancePool /// - /// The child resources to include in the response. + /// Optional request parameter to include managed instance usages within the instance pool. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(bool? expandChildren = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = _managedInstanceRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _usagesRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -327,14 +327,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = _managedInstanceRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _usagesRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -346,23 +346,23 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets all instance pool usage metrics - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages - /// Operation Id: Usages_ListByInstancePool + /// Gets a list of all managed instances in an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances + /// Operation Id: ManagedInstances_ListByInstancePool /// - /// Optional request parameter to include managed instance usages within the instance pool. + /// The child resources to include in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(bool? expandChildren = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = await _usagesRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _managedInstanceRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -370,14 +370,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = await _usagesRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _managedInstanceRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -389,23 +389,23 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH } /// - /// Gets all instance pool usage metrics - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages - /// Operation Id: Usages_ListByInstancePool + /// Gets a list of all managed instances in an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances + /// Operation Id: ManagedInstances_ListByInstancePool /// - /// Optional request parameter to include managed instance usages within the instance pool. + /// The child resources to include in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(bool? expandChildren = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = _usagesRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _managedInstanceRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -413,14 +413,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = _usagesRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _managedInstanceRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupOperationSource.cs new file mode 100644 index 000000000000..30a4fbd01973 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + internal class DistributedAvailabilityGroupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DistributedAvailabilityGroupOperationSource(ArmClient client) + { + _client = client; + } + + DistributedAvailabilityGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DistributedAvailabilityGroupData.DeserializeDistributedAvailabilityGroupData(document.RootElement); + return new DistributedAvailabilityGroupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DistributedAvailabilityGroupData.DeserializeDistributedAvailabilityGroupData(document.RootElement); + return new DistributedAvailabilityGroupResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateOperationSource.cs new file mode 100644 index 000000000000..11953f26fac5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + internal class ServerTrustCertificateOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServerTrustCertificateOperationSource(ArmClient client) + { + _client = client; + } + + ServerTrustCertificateResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ServerTrustCertificateData.DeserializeServerTrustCertificateData(document.RootElement); + return new ServerTrustCertificateResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ServerTrustCertificateData.DeserializeServerTrustCertificateData(document.RootElement); + return new ServerTrustCertificateResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs index 4ab5f289a814..b3059a6698df 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs @@ -67,12 +67,14 @@ public ManagedInstanceData(AzureLocation location) : base(location) /// Specifies maintenance configuration id to apply to this managed instance. /// List of private endpoint connections on a managed instance. /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. - /// The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). /// Whether or not the multi-az is enabled. /// The resource id of a user assigned identity to be used by default. /// A CMK URI of the key to use for encryption. /// The Azure Active Directory administrator of the server. - internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, SqlSku sku, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, string subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, string dnsZonePartner, bool? publicDataEndpointEnabled, string sourceManagedInstanceId, DateTimeOffset? restorePointInOn, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, string instancePoolId, string maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, StorageAccountType? storageAccountType, bool? zoneRedundant, string primaryUserAssignedIdentityId, string keyId, ManagedInstanceExternalAdministrator administrators) : base(id, name, resourceType, systemData, tags, location) + /// The managed instance's service principal. + internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, SqlSku sku, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, string subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, string dnsZonePartner, bool? publicDataEndpointEnabled, string sourceManagedInstanceId, DateTimeOffset? restorePointInOn, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, string instancePoolId, string maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, BackupStorageRedundancy? currentBackupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy, bool? zoneRedundant, string primaryUserAssignedIdentityId, string keyId, ManagedInstanceExternalAdministrator administrators, ServicePrincipal servicePrincipal) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; Sku = sku; @@ -98,11 +100,13 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType re MaintenanceConfigurationId = maintenanceConfigurationId; PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; - StorageAccountType = storageAccountType; + CurrentBackupStorageRedundancy = currentBackupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; ZoneRedundant = zoneRedundant; PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; KeyId = keyId; Administrators = administrators; + ServicePrincipal = servicePrincipal; } /// The Azure Active Directory identity of the managed instance. @@ -166,8 +170,10 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType re public IReadOnlyList PrivateEndpointConnections { get; } /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } - /// The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). - public StorageAccountType? StorageAccountType { get; set; } + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Whether or not the multi-az is enabled. public bool? ZoneRedundant { get; set; } /// The resource id of a user assigned identity to be used by default. @@ -176,5 +182,7 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType re public string KeyId { get; set; } /// The Azure Active Directory administrator of the server. public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// The managed instance's service principal. + public ServicePrincipal ServicePrincipal { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs index 80b39b7b4333..2fe56def57db 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs @@ -531,6 +531,117 @@ public virtual Response GetRestorableD return GetRestorableDroppedManagedDatabases().Get(restorableDroppedDatabaseId, cancellationToken); } + /// Gets a collection of DistributedAvailabilityGroupResources in the ManagedInstance. + /// An object representing collection of DistributedAvailabilityGroupResources and their operations over a DistributedAvailabilityGroupResource. + public virtual DistributedAvailabilityGroupCollection GetDistributedAvailabilityGroups() + { + return GetCachedClient(Client => new DistributedAvailabilityGroupCollection(Client, Id)); + } + + /// + /// Gets a distributed availability group info. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDistributedAvailabilityGroupAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + return await GetDistributedAvailabilityGroups().GetAsync(distributedAvailabilityGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a distributed availability group info. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// Operation Id: DistributedAvailabilityGroups_Get + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDistributedAvailabilityGroup(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + return GetDistributedAvailabilityGroups().Get(distributedAvailabilityGroupName, cancellationToken); + } + + /// Gets a collection of ServerTrustCertificateResources in the ManagedInstance. + /// An object representing collection of ServerTrustCertificateResources and their operations over a ServerTrustCertificateResource. + public virtual ServerTrustCertificateCollection GetServerTrustCertificates() + { + return GetCachedClient(Client => new ServerTrustCertificateCollection(Client, Id)); + } + + /// + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServerTrustCertificateAsync(string certificateName, CancellationToken cancellationToken = default) + { + return await GetServerTrustCertificates().GetAsync(certificateName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServerTrustCertificate(string certificateName, CancellationToken cancellationToken = default) + { + return GetServerTrustCertificates().Get(certificateName, cancellationToken); + } + + /// Gets a collection of EndpointCertificateResources in the ManagedInstance. + /// An object representing collection of EndpointCertificateResources and their operations over a EndpointCertificateResource. + public virtual EndpointCertificateCollection GetEndpointCertificates() + { + return GetCachedClient(Client => new EndpointCertificateCollection(Client, Id)); + } + + /// + /// Gets a certificate used on the endpoint with the given id. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetEndpointCertificateAsync(string endpointType, CancellationToken cancellationToken = default) + { + return await GetEndpointCertificates().GetAsync(endpointType, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a certificate used on the endpoint with the given id. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// Operation Id: EndpointCertificates_Get + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetEndpointCertificate(string endpointType, CancellationToken cancellationToken = default) + { + return GetEndpointCertificates().Get(endpointType, cancellationToken); + } + /// /// Gets a managed instance. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} @@ -777,6 +888,150 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } + /// + /// Creates a TDE certificate for a given server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + /// Operation Id: ManagedInstanceTdeCertificates_Create + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The requested TDE certificate to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual async Task CreateManagedInstanceTdeCertificateAsync(WaitUntil waitUntil, TdeCertificate tdeCertificate, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tdeCertificate, nameof(tdeCertificate)); + + using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); + scope.Start(); + try + { + var response = await _managedInstanceTdeCertificatesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a TDE certificate for a given server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + /// Operation Id: ManagedInstanceTdeCertificates_Create + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The requested TDE certificate to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateManagedInstanceTdeCertificate(WaitUntil waitUntil, TdeCertificate tdeCertificate, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tdeCertificate, nameof(tdeCertificate)); + + using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); + scope.Start(); + try + { + var response = _managedInstanceTdeCertificatesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate, cancellationToken); + var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server trust groups by instance name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups + /// Operation Id: ServerTrustGroups_ListByInstance + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetServerTrustGroupsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = await _serverTrustGroupRestClient.ListByInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = await _serverTrustGroupRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a server trust groups by instance name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups + /// Operation Id: ServerTrustGroups_ListByInstance + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetServerTrustGroups(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = _serverTrustGroupRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = _serverTrustGroupRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + /// /// Get top resource consuming queries of a managed instance. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries @@ -929,150 +1184,6 @@ public virtual ArmOperation Failover(WaitUntil waitUntil, ReplicaType? replicaTy } } - /// - /// Creates a TDE certificate for a given server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates - /// Operation Id: ManagedInstanceTdeCertificates_Create - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The requested TDE certificate to be created or updated. - /// The cancellation token to use. - /// is null. - public virtual async Task CreateManagedInstanceTdeCertificateAsync(WaitUntil waitUntil, TdeCertificate tdeCertificate, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tdeCertificate, nameof(tdeCertificate)); - - using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); - scope.Start(); - try - { - var response = await _managedInstanceTdeCertificatesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates a TDE certificate for a given server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates - /// Operation Id: ManagedInstanceTdeCertificates_Create - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The requested TDE certificate to be created or updated. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation CreateManagedInstanceTdeCertificate(WaitUntil waitUntil, TdeCertificate tdeCertificate, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tdeCertificate, nameof(tdeCertificate)); - - using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); - scope.Start(); - try - { - var response = _managedInstanceTdeCertificatesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate, cancellationToken); - var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tdeCertificate).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a server trust groups by instance name. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups - /// Operation Id: ServerTrustGroups_ListByInstance - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetServerTrustGroupsAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = await _serverTrustGroupRestClient.ListByInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = await _serverTrustGroupRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Gets a server trust groups by instance name. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups - /// Operation Id: ServerTrustGroups_ListByInstance - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetServerTrustGroups(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = _serverTrustGroupRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = _serverTrustGroupRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - /// /// Add a tag to the current resource. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs index f91e87ee069b..128880e8eb89 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// The storage redundancy type of the copied backup. + /// The storage account type used to store backups for this database. public readonly partial struct BackupStorageRedundancy : IEquatable { private readonly string _value; @@ -25,6 +25,7 @@ public BackupStorageRedundancy(string value) private const string GeoValue = "Geo"; private const string LocalValue = "Local"; private const string ZoneValue = "Zone"; + private const string GeoZoneValue = "GeoZone"; /// Geo. public static BackupStorageRedundancy Geo { get; } = new BackupStorageRedundancy(GeoValue); @@ -32,6 +33,8 @@ public BackupStorageRedundancy(string value) public static BackupStorageRedundancy Local { get; } = new BackupStorageRedundancy(LocalValue); /// Zone. public static BackupStorageRedundancy Zone { get; } = new BackupStorageRedundancy(ZoneValue); + /// GeoZone. + public static BackupStorageRedundancy GeoZone { get; } = new BackupStorageRedundancy(GeoZoneValue); /// Determines if two values are the same. public static bool operator ==(BackupStorageRedundancy left, BackupStorageRedundancy right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupOptions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupOptions.cs index ee8fb9555623..ebef9f837b63 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupOptions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupOptions.cs @@ -26,6 +26,6 @@ public CopyLongTermRetentionBackupOptions() /// The name of the database owns the copied backup. public string TargetDatabaseName { get; set; } /// The storage redundancy type of the copied backup. - public TargetBackupStorageRedundancy? TargetBackupStorageRedundancy { get; set; } + public BackupStorageRedundancy? TargetBackupStorageRedundancy { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CurrentBackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CurrentBackupStorageRedundancy.cs deleted file mode 100644 index a4bb6a17adda..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CurrentBackupStorageRedundancy.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The storage account type used to store backups for this database. - public readonly partial struct CurrentBackupStorageRedundancy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public CurrentBackupStorageRedundancy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string GeoValue = "Geo"; - private const string LocalValue = "Local"; - private const string ZoneValue = "Zone"; - - /// Geo. - public static CurrentBackupStorageRedundancy Geo { get; } = new CurrentBackupStorageRedundancy(GeoValue); - /// Local. - public static CurrentBackupStorageRedundancy Local { get; } = new CurrentBackupStorageRedundancy(LocalValue); - /// Zone. - public static CurrentBackupStorageRedundancy Zone { get; } = new CurrentBackupStorageRedundancy(ZoneValue); - /// Determines if two values are the same. - public static bool operator ==(CurrentBackupStorageRedundancy left, CurrentBackupStorageRedundancy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(CurrentBackupStorageRedundancy left, CurrentBackupStorageRedundancy right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator CurrentBackupStorageRedundancy(string value) => new CurrentBackupStorageRedundancy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is CurrentBackupStorageRedundancy other && Equals(other); - /// - public bool Equals(CurrentBackupStorageRedundancy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs new file mode 100644 index 000000000000..8d75b3ce3710 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DatabaseIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IdentityType)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(IdentityType.Value.ToString()); + } + if (Optional.IsCollectionDefined(UserAssignedIdentities)) + { + writer.WritePropertyName("userAssignedIdentities"); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static DatabaseIdentity DeserializeDatabaseIdentity(JsonElement element) + { + Optional type = default; + Optional tenantId = default; + Optional> userAssignedIdentities = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new DatabaseIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("userAssignedIdentities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.ToString())); + } + userAssignedIdentities = dictionary; + continue; + } + } + return new DatabaseIdentity(Optional.ToNullable(type), Optional.ToNullable(tenantId), Optional.ToDictionary(userAssignedIdentities)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs new file mode 100644 index 000000000000..cb6dea0fd6c6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Azure Active Directory identity configuration for a resource. + public partial class DatabaseIdentity + { + /// Initializes a new instance of DatabaseIdentity. + public DatabaseIdentity() + { + UserAssignedIdentities = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of DatabaseIdentity. + /// The identity type. + /// The Azure Active Directory tenant id. + /// The resource ids of the user assigned identities to use. + internal DatabaseIdentity(DatabaseIdentityType? identityType, Guid? tenantId, IDictionary userAssignedIdentities) + { + IdentityType = identityType; + TenantId = tenantId; + UserAssignedIdentities = userAssignedIdentities; + } + + /// The identity type. + public DatabaseIdentityType? IdentityType { get; set; } + /// The Azure Active Directory tenant id. + public Guid? TenantId { get; } + /// The resource ids of the user assigned identities to use. + public IDictionary UserAssignedIdentities { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs new file mode 100644 index 000000000000..263a17f7b722 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The identity type. + public readonly partial struct DatabaseIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatabaseIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string UserAssignedValue = "UserAssigned"; + + /// None. + public static DatabaseIdentityType None { get; } = new DatabaseIdentityType(NoneValue); + /// UserAssigned. + public static DatabaseIdentityType UserAssigned { get; } = new DatabaseIdentityType(UserAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseIdentityType left, DatabaseIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseIdentityType left, DatabaseIdentityType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DatabaseIdentityType(string value) => new DatabaseIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseIdentityType other && Equals(other); + /// + public bool Equals(DatabaseIdentityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs index d55972bd068c..ac4471d21c33 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. public readonly partial struct DatabaseReadScale : IEquatable { private readonly string _value; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs index 0f2a12829f4c..6080fa5ff97d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs @@ -43,6 +43,9 @@ public DatabaseStatus(string value) private const string OfflineChangingDwPerformanceTiersValue = "OfflineChangingDwPerformanceTiers"; private const string OnlineChangingDwPerformanceTiersValue = "OnlineChangingDwPerformanceTiers"; private const string DisabledValue = "Disabled"; + private const string StoppingValue = "Stopping"; + private const string StoppedValue = "Stopped"; + private const string StartingValue = "Starting"; /// Online. public static DatabaseStatus Online { get; } = new DatabaseStatus(OnlineValue); @@ -86,6 +89,12 @@ public DatabaseStatus(string value) public static DatabaseStatus OnlineChangingDwPerformanceTiers { get; } = new DatabaseStatus(OnlineChangingDwPerformanceTiersValue); /// Disabled. public static DatabaseStatus Disabled { get; } = new DatabaseStatus(DisabledValue); + /// Stopping. + public static DatabaseStatus Stopping { get; } = new DatabaseStatus(StoppingValue); + /// Stopped. + public static DatabaseStatus Stopped { get; } = new DatabaseStatus(StoppedValue); + /// Starting. + public static DatabaseStatus Starting { get; } = new DatabaseStatus(StartingValue); /// Determines if two values are the same. public static bool operator ==(DatabaseStatus left, DatabaseStatus right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupData.Serialization.cs new file mode 100644 index 000000000000..ce39e50aa9de --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupData.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + public partial class DistributedAvailabilityGroupData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(TargetDatabase)) + { + writer.WritePropertyName("targetDatabase"); + writer.WriteStringValue(TargetDatabase); + } + if (Optional.IsDefined(SourceEndpoint)) + { + writer.WritePropertyName("sourceEndpoint"); + writer.WriteStringValue(SourceEndpoint); + } + if (Optional.IsDefined(PrimaryAvailabilityGroupName)) + { + writer.WritePropertyName("primaryAvailabilityGroupName"); + writer.WriteStringValue(PrimaryAvailabilityGroupName); + } + if (Optional.IsDefined(SecondaryAvailabilityGroupName)) + { + writer.WritePropertyName("secondaryAvailabilityGroupName"); + writer.WriteStringValue(SecondaryAvailabilityGroupName); + } + if (Optional.IsDefined(ReplicationMode)) + { + writer.WritePropertyName("replicationMode"); + writer.WriteStringValue(ReplicationMode.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DistributedAvailabilityGroupData DeserializeDistributedAvailabilityGroupData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + Optional targetDatabase = default; + Optional sourceEndpoint = default; + Optional primaryAvailabilityGroupName = default; + Optional secondaryAvailabilityGroupName = default; + Optional replicationMode = default; + Optional distributedAvailabilityGroupId = default; + Optional sourceReplicaId = default; + Optional targetReplicaId = default; + Optional linkState = default; + Optional lastHardenedLsn = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("systemData")) + { + systemData = JsonSerializer.Deserialize(property.Value.ToString()); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("targetDatabase")) + { + targetDatabase = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("sourceEndpoint")) + { + sourceEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("primaryAvailabilityGroupName")) + { + primaryAvailabilityGroupName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("secondaryAvailabilityGroupName")) + { + secondaryAvailabilityGroupName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("replicationMode")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + replicationMode = new ReplicationMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("distributedAvailabilityGroupId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + distributedAvailabilityGroupId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("sourceReplicaId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + sourceReplicaId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("targetReplicaId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + targetReplicaId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("linkState")) + { + linkState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastHardenedLsn")) + { + lastHardenedLsn = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new DistributedAvailabilityGroupData(id, name, type, systemData, targetDatabase.Value, sourceEndpoint.Value, primaryAvailabilityGroupName.Value, secondaryAvailabilityGroupName.Value, Optional.ToNullable(replicationMode), Optional.ToNullable(distributedAvailabilityGroupId), Optional.ToNullable(sourceReplicaId), Optional.ToNullable(targetReplicaId), linkState.Value, lastHardenedLsn.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.Serialization.cs new file mode 100644 index 000000000000..855eeb4d2213 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class DistributedAvailabilityGroupsListResult + { + internal static DistributedAvailabilityGroupsListResult DeserializeDistributedAvailabilityGroupsListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DistributedAvailabilityGroupData.DeserializeDistributedAvailabilityGroupData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DistributedAvailabilityGroupsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.cs new file mode 100644 index 000000000000..6ffe53b29775 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of distributed availability groups in instance. + internal partial class DistributedAvailabilityGroupsListResult + { + /// Initializes a new instance of DistributedAvailabilityGroupsListResult. + internal DistributedAvailabilityGroupsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DistributedAvailabilityGroupsListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal DistributedAvailabilityGroupsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolData.Serialization.cs index 9184a7a6fe37..40213f72941b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolData.Serialization.cs @@ -61,6 +61,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maintenanceConfigurationId"); writer.WriteStringValue(MaintenanceConfigurationId); } + if (Optional.IsDefined(HighAvailabilityReplicaCount)) + { + writer.WritePropertyName("highAvailabilityReplicaCount"); + writer.WriteNumberValue(HighAvailabilityReplicaCount.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -82,6 +87,7 @@ internal static ElasticPoolData DeserializeElasticPoolData(JsonElement element) Optional zoneRedundant = default; Optional licenseType = default; Optional maintenanceConfigurationId = default; + Optional highAvailabilityReplicaCount = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) @@ -208,11 +214,21 @@ internal static ElasticPoolData DeserializeElasticPoolData(JsonElement element) maintenanceConfigurationId = property0.Value.GetString(); continue; } + if (property0.NameEquals("highAvailabilityReplicaCount")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + highAvailabilityReplicaCount = property0.Value.GetInt32(); + continue; + } } continue; } } - return new ElasticPoolData(id, name, type, systemData, tags, location, sku.Value, kind.Value, Optional.ToNullable(state), Optional.ToNullable(creationDate), Optional.ToNullable(maxSizeBytes), perDatabaseSettings.Value, Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), maintenanceConfigurationId.Value); + return new ElasticPoolData(id, name, type, systemData, tags, location, sku.Value, kind.Value, Optional.ToNullable(state), Optional.ToNullable(creationDate), Optional.ToNullable(maxSizeBytes), perDatabaseSettings.Value, Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), maintenanceConfigurationId.Value, Optional.ToNullable(highAvailabilityReplicaCount)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.Serialization.cs index 4cad3d0b353a..7c5558454d21 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.Serialization.cs @@ -58,6 +58,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maintenanceConfigurationId"); writer.WriteStringValue(MaintenanceConfigurationId); } + if (Optional.IsDefined(HighAvailabilityReplicaCount)) + { + writer.WritePropertyName("highAvailabilityReplicaCount"); + writer.WriteNumberValue(HighAvailabilityReplicaCount.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.cs index 05a82696c1ad..e5e3ebef62dc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPatch.cs @@ -33,5 +33,7 @@ public ElasticPoolPatch() public ElasticPoolLicenseType? LicenseType { get; set; } /// Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. public string MaintenanceConfigurationId { get; set; } + /// The number of secondary replicas associated with the elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic pools. + public int? HighAvailabilityReplicaCount { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateData.Serialization.cs similarity index 67% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateData.Serialization.cs index 4e98b638b99c..7a2d1a1a3014 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateData.Serialization.cs @@ -9,28 +9,31 @@ using Azure.Core; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Sql.Models +namespace Azure.ResourceManager.Sql { - public partial class OperationsHealth : IUtf8JsonSerializable + public partial class EndpointCertificateData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"); writer.WriteStartObject(); + if (Optional.IsDefined(PublicBlob)) + { + writer.WritePropertyName("publicBlob"); + writer.WriteStringValue(PublicBlob); + } writer.WriteEndObject(); writer.WriteEndObject(); } - internal static OperationsHealth DeserializeOperationsHealth(JsonElement element) + internal static EndpointCertificateData DeserializeEndpointCertificateData(JsonElement element) { ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - Optional name0 = default; - Optional health = default; - Optional description = default; + Optional publicBlob = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -62,26 +65,16 @@ internal static OperationsHealth DeserializeOperationsHealth(JsonElement element } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("name")) - { - name0 = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("health")) - { - health = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description")) + if (property0.NameEquals("publicBlob")) { - description = property0.Value.GetString(); + publicBlob = property0.Value.GetString(); continue; } } continue; } } - return new OperationsHealth(id, name, type, systemData, name0.Value, health.Value, description.Value); + return new EndpointCertificateData(id, name, type, systemData, publicBlob.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.Serialization.cs new file mode 100644 index 000000000000..899c6e06a507 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class EndpointCertificateListResult + { + internal static EndpointCertificateListResult DeserializeEndpointCertificateListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EndpointCertificateData.DeserializeEndpointCertificateData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new EndpointCertificateListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.cs new file mode 100644 index 000000000000..6ea7e0d6adc9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EndpointCertificateListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of endpoint certificates on the target instance. + internal partial class EndpointCertificateListResult + { + /// Initializes a new instance of EndpointCertificateListResult. + internal EndpointCertificateListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of EndpointCertificateListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal EndpointCertificateListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleData.Serialization.cs new file mode 100644 index 000000000000..06fbd734d24a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleData.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql +{ + public partial class IPv6FirewallRuleData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(StartIPv6Address)) + { + writer.WritePropertyName("startIPv6Address"); + writer.WriteStringValue(StartIPv6Address); + } + if (Optional.IsDefined(EndIPv6Address)) + { + writer.WritePropertyName("endIPv6Address"); + writer.WriteStringValue(EndIPv6Address); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static IPv6FirewallRuleData DeserializeIPv6FirewallRuleData(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional startIPv6Address = default; + Optional endIPv6Address = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("startIPv6Address")) + { + startIPv6Address = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("endIPv6Address")) + { + endIPv6Address = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new IPv6FirewallRuleData(id.Value, name.Value, type.Value, startIPv6Address.Value, endIPv6Address.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleListResult.Serialization.cs similarity index 68% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleListResult.Serialization.cs index e3c818cd1a17..b25f8d2f6268 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleListResult.Serialization.cs @@ -8,14 +8,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Sql; namespace Azure.ResourceManager.Sql.Models { - internal partial class OperationsHealthListResult + internal partial class IPv6FirewallRuleListResult { - internal static OperationsHealthListResult DeserializeOperationsHealthListResult(JsonElement element) + internal static IPv6FirewallRuleListResult DeserializeIPv6FirewallRuleListResult(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static OperationsHealthListResult DeserializeOperationsHealthListResult property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(OperationsHealth.DeserializeOperationsHealth(item)); + array.Add(IPv6FirewallRuleData.DeserializeIPv6FirewallRuleData(item)); } value = array; continue; @@ -40,7 +41,7 @@ internal static OperationsHealthListResult DeserializeOperationsHealthListResult continue; } } - return new OperationsHealthListResult(Optional.ToList(value), nextLink.Value); + return new IPv6FirewallRuleListResult(Optional.ToList(value), nextLink.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleListResult.cs similarity index 50% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleListResult.cs index 5c2dd6138dcd..445c41af058a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleListResult.cs @@ -7,29 +7,30 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Sql; namespace Azure.ResourceManager.Sql.Models { - /// A list of service health statuses in a location. - internal partial class OperationsHealthListResult + /// The response to a list IPv6 firewall rules request. + internal partial class IPv6FirewallRuleListResult { - /// Initializes a new instance of OperationsHealthListResult. - internal OperationsHealthListResult() + /// Initializes a new instance of IPv6FirewallRuleListResult. + internal IPv6FirewallRuleListResult() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } - /// Initializes a new instance of OperationsHealthListResult. + /// Initializes a new instance of IPv6FirewallRuleListResult. /// Array of results. /// Link to retrieve next page of results. - internal OperationsHealthListResult(IReadOnlyList value, string nextLink) + internal IPv6FirewallRuleListResult(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// Array of results. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// Link to retrieve next page of results. public string NextLink { get; } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceData.Serialization.cs index 1b33bc6fcde7..01a626228bf3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceData.Serialization.cs @@ -127,10 +127,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"); writer.WriteStringValue(MinimalTlsVersion); } - if (Optional.IsDefined(StorageAccountType)) + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) { - writer.WritePropertyName("storageAccountType"); - writer.WriteStringValue(StorageAccountType.Value.ToString()); + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); } if (Optional.IsDefined(ZoneRedundant)) { @@ -152,6 +152,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("administrators"); writer.WriteObjectValue(Administrators); } + if (Optional.IsDefined(ServicePrincipal)) + { + writer.WritePropertyName("servicePrincipal"); + writer.WriteObjectValue(ServicePrincipal); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -188,11 +193,13 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e Optional maintenanceConfigurationId = default; Optional> privateEndpointConnections = default; Optional minimalTlsVersion = default; - Optional storageAccountType = default; + Optional currentBackupStorageRedundancy = default; + Optional requestedBackupStorageRedundancy = default; Optional zoneRedundant = default; Optional primaryUserAssignedIdentityId = default; Optional keyId = default; Optional administrators = default; + Optional servicePrincipal = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity")) @@ -420,14 +427,24 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e minimalTlsVersion = property0.Value.GetString(); continue; } - if (property0.NameEquals("storageAccountType")) + if (property0.NameEquals("currentBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + currentBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("requestedBackupStorageRedundancy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - storageAccountType = new StorageAccountType(property0.Value.GetString()); + requestedBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); continue; } if (property0.NameEquals("zoneRedundant")) @@ -460,11 +477,21 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e administrators = ManagedInstanceExternalAdministrator.DeserializeManagedInstanceExternalAdministrator(property0.Value); continue; } + if (property0.NameEquals("servicePrincipal")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + servicePrincipal = ServicePrincipal.DeserializeServicePrincipal(property0.Value); + continue; + } } continue; } } - return new ManagedInstanceData(id, name, type, systemData, tags, location, identity, sku.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(managedInstanceCreateMode), fullyQualifiedDomainName.Value, administratorLogin.Value, administratorLoginPassword.Value, subnetId.Value, state.Value, Optional.ToNullable(licenseType), Optional.ToNullable(vCores), Optional.ToNullable(storageSizeInGB), collation.Value, dnsZone.Value, dnsZonePartner.Value, Optional.ToNullable(publicDataEndpointEnabled), sourceManagedInstanceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(proxyOverride), timezoneId.Value, instancePoolId.Value, maintenanceConfigurationId.Value, Optional.ToList(privateEndpointConnections), minimalTlsVersion.Value, Optional.ToNullable(storageAccountType), Optional.ToNullable(zoneRedundant), primaryUserAssignedIdentityId.Value, keyId.Value, administrators.Value); + return new ManagedInstanceData(id, name, type, systemData, tags, location, identity, sku.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(managedInstanceCreateMode), fullyQualifiedDomainName.Value, administratorLogin.Value, administratorLoginPassword.Value, subnetId.Value, state.Value, Optional.ToNullable(licenseType), Optional.ToNullable(vCores), Optional.ToNullable(storageSizeInGB), collation.Value, dnsZone.Value, dnsZonePartner.Value, Optional.ToNullable(publicDataEndpointEnabled), sourceManagedInstanceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(proxyOverride), timezoneId.Value, instancePoolId.Value, maintenanceConfigurationId.Value, Optional.ToList(privateEndpointConnections), minimalTlsVersion.Value, Optional.ToNullable(currentBackupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(zoneRedundant), primaryUserAssignedIdentityId.Value, keyId.Value, administrators.Value, servicePrincipal.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs index 6eb545e83d0b..8d43eced2140 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs @@ -125,10 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"); writer.WriteStringValue(MinimalTlsVersion); } - if (Optional.IsDefined(StorageAccountType)) + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) { - writer.WritePropertyName("storageAccountType"); - writer.WriteStringValue(StorageAccountType.Value.ToString()); + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); } if (Optional.IsDefined(ZoneRedundant)) { @@ -150,6 +150,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("administrators"); writer.WriteObjectValue(Administrators); } + if (Optional.IsDefined(ServicePrincipal)) + { + writer.WritePropertyName("servicePrincipal"); + writer.WriteObjectValue(ServicePrincipal); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs index 2773deb6818e..5e4658f89717 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs @@ -85,8 +85,10 @@ public ManagedInstancePatch() public IReadOnlyList PrivateEndpointConnections { get; } /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } - /// The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). - public StorageAccountType? StorageAccountType { get; set; } + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Whether or not the multi-az is enabled. public bool? ZoneRedundant { get; set; } /// The resource id of a user assigned identity to be used by default. @@ -95,5 +97,7 @@ public ManagedInstancePatch() public string KeyId { get; set; } /// The Azure Active Directory administrator of the server. public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// The managed instance's service principal. + public ServicePrincipal ServicePrincipal { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs index 309aee81a204..4e611e194278 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs @@ -28,6 +28,15 @@ public ManagedInstancePropertiesProvisioningState(string value) private const string UnknownValue = "Unknown"; private const string SucceededValue = "Succeeded"; private const string FailedValue = "Failed"; + private const string AcceptedValue = "Accepted"; + private const string CreatedValue = "Created"; + private const string DeletedValue = "Deleted"; + private const string UnrecognizedValue = "Unrecognized"; + private const string RunningValue = "Running"; + private const string CanceledValue = "Canceled"; + private const string NotSpecifiedValue = "NotSpecified"; + private const string RegisteringValue = "Registering"; + private const string TimedOutValue = "TimedOut"; /// Creating. public static ManagedInstancePropertiesProvisioningState Creating { get; } = new ManagedInstancePropertiesProvisioningState(CreatingValue); @@ -41,6 +50,24 @@ public ManagedInstancePropertiesProvisioningState(string value) public static ManagedInstancePropertiesProvisioningState Succeeded { get; } = new ManagedInstancePropertiesProvisioningState(SucceededValue); /// Failed. public static ManagedInstancePropertiesProvisioningState Failed { get; } = new ManagedInstancePropertiesProvisioningState(FailedValue); + /// Accepted. + public static ManagedInstancePropertiesProvisioningState Accepted { get; } = new ManagedInstancePropertiesProvisioningState(AcceptedValue); + /// Created. + public static ManagedInstancePropertiesProvisioningState Created { get; } = new ManagedInstancePropertiesProvisioningState(CreatedValue); + /// Deleted. + public static ManagedInstancePropertiesProvisioningState Deleted { get; } = new ManagedInstancePropertiesProvisioningState(DeletedValue); + /// Unrecognized. + public static ManagedInstancePropertiesProvisioningState Unrecognized { get; } = new ManagedInstancePropertiesProvisioningState(UnrecognizedValue); + /// Running. + public static ManagedInstancePropertiesProvisioningState Running { get; } = new ManagedInstancePropertiesProvisioningState(RunningValue); + /// Canceled. + public static ManagedInstancePropertiesProvisioningState Canceled { get; } = new ManagedInstancePropertiesProvisioningState(CanceledValue); + /// NotSpecified. + public static ManagedInstancePropertiesProvisioningState NotSpecified { get; } = new ManagedInstancePropertiesProvisioningState(NotSpecifiedValue); + /// Registering. + public static ManagedInstancePropertiesProvisioningState Registering { get; } = new ManagedInstancePropertiesProvisioningState(RegisteringValue); + /// TimedOut. + public static ManagedInstancePropertiesProvisioningState TimedOut { get; } = new ManagedInstancePropertiesProvisioningState(TimedOutValue); /// Determines if two values are the same. public static bool operator ==(ManagedInstancePropertiesProvisioningState left, ManagedInstancePropertiesProvisioningState right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.cs deleted file mode 100644 index 60f70e595797..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Operations health status in a location. - public partial class OperationsHealth : ResourceData - { - /// Initializes a new instance of OperationsHealth. - public OperationsHealth() - { - } - - /// Initializes a new instance of OperationsHealth. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Operation name for the service. - /// Operation health status of the service. - /// Health status description. - internal OperationsHealth(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string namePropertiesName, string health, string description) : base(id, name, resourceType, systemData) - { - NamePropertiesName = namePropertiesName; - Health = health; - Description = description; - } - - /// Operation name for the service. - public string NamePropertiesName { get; } - /// Operation health status of the service. - public string Health { get; } - /// Health status description. - public string Description { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationMode.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationMode.cs new file mode 100644 index 000000000000..56bbcbea94da --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The replication mode of a distributed availability group. Parameter will be ignored during link creation. + public readonly partial struct ReplicationMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ReplicationMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AsyncValue = "Async"; + private const string SyncValue = "Sync"; + + /// Async. + public static ReplicationMode Async { get; } = new ReplicationMode(AsyncValue); + /// Sync. + public static ReplicationMode Sync { get; } = new ReplicationMode(SyncValue); + /// Determines if two values are the same. + public static bool operator ==(ReplicationMode left, ReplicationMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReplicationMode left, ReplicationMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ReplicationMode(string value) => new ReplicationMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicationMode other && Equals(other); + /// + public bool Equals(ReplicationMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs deleted file mode 100644 index c607d93cbc8d..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The storage redundancy type of the copied backup. - public readonly partial struct RequestedBackupStorageRedundancy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RequestedBackupStorageRedundancy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string GeoValue = "Geo"; - private const string LocalValue = "Local"; - private const string ZoneValue = "Zone"; - - /// Geo. - public static RequestedBackupStorageRedundancy Geo { get; } = new RequestedBackupStorageRedundancy(GeoValue); - /// Local. - public static RequestedBackupStorageRedundancy Local { get; } = new RequestedBackupStorageRedundancy(LocalValue); - /// Zone. - public static RequestedBackupStorageRedundancy Zone { get; } = new RequestedBackupStorageRedundancy(ZoneValue); - /// Determines if two values are the same. - public static bool operator ==(RequestedBackupStorageRedundancy left, RequestedBackupStorageRedundancy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RequestedBackupStorageRedundancy left, RequestedBackupStorageRedundancy right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator RequestedBackupStorageRedundancy(string value) => new RequestedBackupStorageRedundancy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RequestedBackupStorageRedundancy other && Equals(other); - /// - public bool Equals(RequestedBackupStorageRedundancy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseData.Serialization.cs index 10f82db57e74..acee7a6e1723 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseData.Serialization.cs @@ -57,11 +57,10 @@ internal static RestorableDroppedDatabaseData DeserializeRestorableDroppedDataba SystemData systemData = default; Optional databaseName = default; Optional maxSizeBytes = default; - Optional elasticPoolId = default; Optional creationDate = default; Optional deletionDate = default; Optional earliestRestoreDate = default; - Optional backupStorageRedundancy = default; + Optional backupStorageRedundancy = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) @@ -138,11 +137,6 @@ internal static RestorableDroppedDatabaseData DeserializeRestorableDroppedDataba maxSizeBytes = property0.Value.GetInt64(); continue; } - if (property0.NameEquals("elasticPoolId")) - { - elasticPoolId = property0.Value.GetString(); - continue; - } if (property0.NameEquals("creationDate")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -180,14 +174,14 @@ internal static RestorableDroppedDatabaseData DeserializeRestorableDroppedDataba property0.ThrowNonNullablePropertyIsNull(); continue; } - backupStorageRedundancy = new RestorableDroppedDatabasePropertiesBackupStorageRedundancy(property0.Value.GetString()); + backupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); continue; } } continue; } } - return new RestorableDroppedDatabaseData(id, name, type, systemData, sku.Value, location.Value, Optional.ToDictionary(tags), databaseName.Value, Optional.ToNullable(maxSizeBytes), elasticPoolId.Value, Optional.ToNullable(creationDate), Optional.ToNullable(deletionDate), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(backupStorageRedundancy)); + return new RestorableDroppedDatabaseData(id, name, type, systemData, sku.Value, location.Value, Optional.ToDictionary(tags), databaseName.Value, Optional.ToNullable(maxSizeBytes), Optional.ToNullable(creationDate), Optional.ToNullable(deletionDate), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(backupStorageRedundancy)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabasePropertiesBackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabasePropertiesBackupStorageRedundancy.cs deleted file mode 100644 index 58e9e1443239..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabasePropertiesBackupStorageRedundancy.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The storage account type used to store backups for this database. - public readonly partial struct RestorableDroppedDatabasePropertiesBackupStorageRedundancy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RestorableDroppedDatabasePropertiesBackupStorageRedundancy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string GeoValue = "Geo"; - private const string LocalValue = "Local"; - private const string ZoneValue = "Zone"; - - /// Geo. - public static RestorableDroppedDatabasePropertiesBackupStorageRedundancy Geo { get; } = new RestorableDroppedDatabasePropertiesBackupStorageRedundancy(GeoValue); - /// Local. - public static RestorableDroppedDatabasePropertiesBackupStorageRedundancy Local { get; } = new RestorableDroppedDatabasePropertiesBackupStorageRedundancy(LocalValue); - /// Zone. - public static RestorableDroppedDatabasePropertiesBackupStorageRedundancy Zone { get; } = new RestorableDroppedDatabasePropertiesBackupStorageRedundancy(ZoneValue); - /// Determines if two values are the same. - public static bool operator ==(RestorableDroppedDatabasePropertiesBackupStorageRedundancy left, RestorableDroppedDatabasePropertiesBackupStorageRedundancy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RestorableDroppedDatabasePropertiesBackupStorageRedundancy left, RestorableDroppedDatabasePropertiesBackupStorageRedundancy right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator RestorableDroppedDatabasePropertiesBackupStorageRedundancy(string value) => new RestorableDroppedDatabasePropertiesBackupStorageRedundancy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RestorableDroppedDatabasePropertiesBackupStorageRedundancy other && Equals(other); - /// - public bool Equals(RestorableDroppedDatabasePropertiesBackupStorageRedundancy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SampleName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SampleName.cs new file mode 100644 index 000000000000..9cd4f5c60ec2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SampleName.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The name of the sample schema to apply when creating this database. + public readonly partial struct SampleName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SampleName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AdventureWorksLTValue = "AdventureWorksLT"; + private const string WideWorldImportersStdValue = "WideWorldImportersStd"; + private const string WideWorldImportersFullValue = "WideWorldImportersFull"; + + /// AdventureWorksLT. + public static SampleName AdventureWorksLT { get; } = new SampleName(AdventureWorksLTValue); + /// WideWorldImportersStd. + public static SampleName WideWorldImportersStd { get; } = new SampleName(WideWorldImportersStdValue); + /// WideWorldImportersFull. + public static SampleName WideWorldImportersFull { get; } = new SampleName(WideWorldImportersFullValue); + /// Determines if two values are the same. + public static bool operator ==(SampleName left, SampleName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SampleName left, SampleName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SampleName(string value) => new SampleName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SampleName other && Equals(other); + /// + public bool Equals(SampleName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificateData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificateData.Serialization.cs new file mode 100644 index 000000000000..8f9b6f8250a4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificateData.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + public partial class ServerTrustCertificateData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(PublicBlob)) + { + writer.WritePropertyName("publicBlob"); + writer.WriteStringValue(PublicBlob); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ServerTrustCertificateData DeserializeServerTrustCertificateData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + Optional publicBlob = default; + Optional thumbprint = default; + Optional certificateName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("systemData")) + { + systemData = JsonSerializer.Deserialize(property.Value.ToString()); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("publicBlob")) + { + publicBlob = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("thumbprint")) + { + thumbprint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("certificateName")) + { + certificateName = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ServerTrustCertificateData(id, name, type, systemData, publicBlob.Value, thumbprint.Value, certificateName.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.Serialization.cs new file mode 100644 index 000000000000..14cfd650be47 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ServerTrustCertificatesListResult + { + internal static ServerTrustCertificatesListResult DeserializeServerTrustCertificatesListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServerTrustCertificateData.DeserializeServerTrustCertificateData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ServerTrustCertificatesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.cs new file mode 100644 index 000000000000..62cafb176957 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificatesListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of server trust certificates in instance. + internal partial class ServerTrustCertificatesListResult + { + /// Initializes a new instance of ServerTrustCertificatesListResult. + internal ServerTrustCertificatesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServerTrustCertificatesListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ServerTrustCertificatesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs new file mode 100644 index 000000000000..d18a68214652 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ServicePrincipal : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ServicePrincipal DeserializeServicePrincipal(JsonElement element) + { + Optional principalId = default; + Optional clientId = default; + Optional tenantId = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId")) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new ServicePrincipalType(property.Value.GetString()); + continue; + } + } + return new ServicePrincipal(principalId.Value, clientId.Value, tenantId.Value, Optional.ToNullable(type)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs new file mode 100644 index 000000000000..f86e34dd10a4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The managed instance's service principal configuration for a resource. + public partial class ServicePrincipal + { + /// Initializes a new instance of ServicePrincipal. + public ServicePrincipal() + { + } + + /// Initializes a new instance of ServicePrincipal. + /// The Azure Active Directory application object id. + /// The Azure Active Directory application client id. + /// The Azure Active Directory tenant id. + /// Service principal type. + internal ServicePrincipal(string principalId, string clientId, string tenantId, ServicePrincipalType? principalType) + { + PrincipalId = principalId; + ClientId = clientId; + TenantId = tenantId; + PrincipalType = principalType; + } + + /// The Azure Active Directory application object id. + public string PrincipalId { get; } + /// The Azure Active Directory application client id. + public string ClientId { get; } + /// The Azure Active Directory tenant id. + public string TenantId { get; } + /// Service principal type. + public ServicePrincipalType? PrincipalType { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs new file mode 100644 index 000000000000..e1ddae478065 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Service principal type. + public readonly partial struct ServicePrincipalType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ServicePrincipalType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string SystemAssignedValue = "SystemAssigned"; + + /// None. + public static ServicePrincipalType None { get; } = new ServicePrincipalType(NoneValue); + /// SystemAssigned. + public static ServicePrincipalType SystemAssigned { get; } = new ServicePrincipalType(SystemAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(ServicePrincipalType left, ServicePrincipalType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServicePrincipalType left, ServicePrincipalType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServicePrincipalType(string value) => new ServicePrincipalType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServicePrincipalType other && Equals(other); + /// + public bool Equals(ServicePrincipalType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabaseData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabaseData.Serialization.cs index 511d5c281156..2f62555da3fd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabaseData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabaseData.Serialization.cs @@ -24,6 +24,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("tags"); writer.WriteStartObject(); foreach (var item in Tags) @@ -151,6 +156,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isLedgerOn"); writer.WriteBooleanValue(IsLedgerOn.Value); } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"); + writer.WriteStringValue(FederatedClientId.Value); + } + if (Optional.IsDefined(SourceResourceId)) + { + writer.WritePropertyName("sourceResourceId"); + writer.WriteStringValue(SourceResourceId); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -160,6 +175,7 @@ internal static SqlDatabaseData DeserializeSqlDatabaseData(JsonElement element) Optional sku = default; Optional kind = default; Optional managedBy = default; + Optional identity = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -195,14 +211,16 @@ internal static SqlDatabaseData DeserializeSqlDatabaseData(JsonElement element) Optional secondaryType = default; Optional currentSku = default; Optional autoPauseDelay = default; - Optional currentBackupStorageRedundancy = default; - Optional requestedBackupStorageRedundancy = default; + Optional currentBackupStorageRedundancy = default; + Optional requestedBackupStorageRedundancy = default; Optional minCapacity = default; Optional pausedDate = default; Optional resumedDate = default; Optional maintenanceConfigurationId = default; Optional isLedgerOn = default; Optional isInfraEncryptionEnabled = default; + Optional federatedClientId = default; + Optional sourceResourceId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) @@ -225,6 +243,16 @@ internal static SqlDatabaseData DeserializeSqlDatabaseData(JsonElement element) managedBy = property.Value.GetString(); continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = DatabaseIdentity.DeserializeDatabaseIdentity(property.Value); + continue; + } if (property.NameEquals("tags")) { Dictionary dictionary = new Dictionary(); @@ -511,7 +539,7 @@ internal static SqlDatabaseData DeserializeSqlDatabaseData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - currentBackupStorageRedundancy = new CurrentBackupStorageRedundancy(property0.Value.GetString()); + currentBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); continue; } if (property0.NameEquals("requestedBackupStorageRedundancy")) @@ -521,7 +549,7 @@ internal static SqlDatabaseData DeserializeSqlDatabaseData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - requestedBackupStorageRedundancy = new RequestedBackupStorageRedundancy(property0.Value.GetString()); + requestedBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); continue; } if (property0.NameEquals("minCapacity")) @@ -579,11 +607,26 @@ internal static SqlDatabaseData DeserializeSqlDatabaseData(JsonElement element) isInfraEncryptionEnabled = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("federatedClientId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + federatedClientId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("sourceResourceId")) + { + sourceResourceId = property0.Value.GetString(); + continue; + } } continue; } } - return new SqlDatabaseData(id, name, type, systemData, tags, location, sku.Value, kind.Value, managedBy.Value, Optional.ToNullable(createMode), collation.Value, Optional.ToNullable(maxSizeBytes), Optional.ToNullable(sampleName), elasticPoolId.Value, sourceDatabaseId.Value, Optional.ToNullable(status), Optional.ToNullable(databaseId), Optional.ToNullable(creationDate), currentServiceObjectiveName.Value, requestedServiceObjectiveName.Value, defaultSecondaryLocation.Value, failoverGroupId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(sourceDatabaseDeletionDate), recoveryServicesRecoveryPointId.Value, longTermRetentionBackupResourceId.Value, recoverableDatabaseId.Value, restorableDroppedDatabaseId.Value, Optional.ToNullable(catalogCollation), Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), Optional.ToNullable(maxLogSizeBytes), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(readScale), Optional.ToNullable(highAvailabilityReplicaCount), Optional.ToNullable(secondaryType), currentSku.Value, Optional.ToNullable(autoPauseDelay), Optional.ToNullable(currentBackupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(minCapacity), Optional.ToNullable(pausedDate), Optional.ToNullable(resumedDate), maintenanceConfigurationId.Value, Optional.ToNullable(isLedgerOn), Optional.ToNullable(isInfraEncryptionEnabled)); + return new SqlDatabaseData(id, name, type, systemData, tags, location, sku.Value, kind.Value, managedBy.Value, identity.Value, Optional.ToNullable(createMode), collation.Value, Optional.ToNullable(maxSizeBytes), Optional.ToNullable(sampleName), elasticPoolId.Value, sourceDatabaseId.Value, Optional.ToNullable(status), Optional.ToNullable(databaseId), Optional.ToNullable(creationDate), currentServiceObjectiveName.Value, requestedServiceObjectiveName.Value, defaultSecondaryLocation.Value, failoverGroupId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(sourceDatabaseDeletionDate), recoveryServicesRecoveryPointId.Value, longTermRetentionBackupResourceId.Value, recoverableDatabaseId.Value, restorableDroppedDatabaseId.Value, Optional.ToNullable(catalogCollation), Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), Optional.ToNullable(maxLogSizeBytes), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(readScale), Optional.ToNullable(highAvailabilityReplicaCount), Optional.ToNullable(secondaryType), currentSku.Value, Optional.ToNullable(autoPauseDelay), Optional.ToNullable(currentBackupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(minCapacity), Optional.ToNullable(pausedDate), Optional.ToNullable(resumedDate), maintenanceConfigurationId.Value, Optional.ToNullable(isLedgerOn), Optional.ToNullable(isInfraEncryptionEnabled), Optional.ToNullable(federatedClientId), sourceResourceId.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.Serialization.cs index f2ca1ae44cd8..f33d9258e12a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.Serialization.cs @@ -20,6 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"); @@ -148,6 +153,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isLedgerOn"); writer.WriteBooleanValue(IsLedgerOn.Value); } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"); + writer.WriteStringValue(FederatedClientId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.cs index c405309e1ecb..664421ee28be 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// A database resource. + /// A database update resource. public partial class SqlDatabasePatch { /// Initializes a new instance of SqlDatabasePatch. @@ -22,6 +22,8 @@ public SqlDatabasePatch() /// The name and tier of the SKU. public SqlSku Sku { get; set; } + /// Database identity. + public DatabaseIdentity Identity { get; set; } /// Resource tags. public IDictionary Tags { get; } /// @@ -49,7 +51,7 @@ public SqlDatabasePatch() /// The max size of the database expressed in bytes. public long? MaxSizeBytes { get; set; } /// The name of the sample schema to apply when creating this database. - public SampleSchemaName? SampleName { get; set; } + public SampleName? SampleName { get; set; } /// The resource identifier of the elastic pool containing this database. public string ElasticPoolId { get; set; } /// The resource identifier of the source database associated with create operation of this database. @@ -90,9 +92,9 @@ public SqlDatabasePatch() public long? MaxLogSizeBytes { get; } /// This records the earliest start date and time that restore is available for this database (ISO8601 format). public DateTimeOffset? EarliestRestoreOn { get; } - /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. public DatabaseReadScale? ReadScale { get; set; } - /// The number of secondary replicas associated with the database that are used to provide high availability. + /// The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. public int? HighAvailabilityReplicaCount { get; set; } /// The secondary type of the database if it is a secondary. Valid values are Geo and Named. public SecondaryType? SecondaryType { get; set; } @@ -101,9 +103,9 @@ public SqlDatabasePatch() /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. public int? AutoPauseDelay { get; set; } /// The storage account type used to store backups for this database. - public CurrentBackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } /// The storage account type to be used to store backups for this database. - public RequestedBackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Minimal capacity that database will always have allocated, if not paused. public double? MinCapacity { get; set; } /// The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. @@ -116,5 +118,7 @@ public SqlDatabasePatch() public bool? IsLedgerOn { get; set; } /// Infra encryption is enabled for this database. public bool? IsInfraEncryptionEnabled { get; } + /// The Client id used for cross tenant per database CMK scenario. + public Guid? FederatedClientId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageAccountType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageAccountType.cs deleted file mode 100644 index 3228d0238f9f..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageAccountType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). - public readonly partial struct StorageAccountType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public StorageAccountType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string GRSValue = "GRS"; - private const string LRSValue = "LRS"; - private const string ZRSValue = "ZRS"; - - /// GRS. - public static StorageAccountType GRS { get; } = new StorageAccountType(GRSValue); - /// LRS. - public static StorageAccountType LRS { get; } = new StorageAccountType(LRSValue); - /// ZRS. - public static StorageAccountType ZRS { get; } = new StorageAccountType(ZRSValue); - /// Determines if two values are the same. - public static bool operator ==(StorageAccountType left, StorageAccountType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(StorageAccountType left, StorageAccountType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator StorageAccountType(string value) => new StorageAccountType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is StorageAccountType other && Equals(other); - /// - public bool Equals(StorageAccountType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TargetBackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TargetBackupStorageRedundancy.cs deleted file mode 100644 index 6dd57e682089..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TargetBackupStorageRedundancy.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The storage redundancy type of the copied backup. - public readonly partial struct TargetBackupStorageRedundancy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public TargetBackupStorageRedundancy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string GeoValue = "Geo"; - private const string LocalValue = "Local"; - private const string ZoneValue = "Zone"; - - /// Geo. - public static TargetBackupStorageRedundancy Geo { get; } = new TargetBackupStorageRedundancy(GeoValue); - /// Local. - public static TargetBackupStorageRedundancy Local { get; } = new TargetBackupStorageRedundancy(LocalValue); - /// Zone. - public static TargetBackupStorageRedundancy Zone { get; } = new TargetBackupStorageRedundancy(ZoneValue); - /// Determines if two values are the same. - public static bool operator ==(TargetBackupStorageRedundancy left, TargetBackupStorageRedundancy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(TargetBackupStorageRedundancy left, TargetBackupStorageRedundancy right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator TargetBackupStorageRedundancy(string value) => new TargetBackupStorageRedundancy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is TargetBackupStorageRedundancy other && Equals(other); - /// - public bool Equals(TargetBackupStorageRedundancy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupOptions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupOptions.cs index 6acad900ebfe..06593a8d5093 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupOptions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupOptions.cs @@ -16,6 +16,6 @@ public UpdateLongTermRetentionBackupOptions() } /// The storage redundancy type of the copied backup. - public RequestedBackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabasesRestOperations.cs index ba069bbf311d..e1b64597887e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabasesRestOperations.cs @@ -632,11 +632,11 @@ public Response Update(string subscriptionId, string resourceGroupName, string s } } - internal HttpMessage CreateListByElasticPoolRequest(string subscriptionId, string resourceGroupName, string serverName, string elasticPoolName) + internal HttpMessage CreateExportRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition exportDatabaseDefinition) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -645,73 +645,73 @@ internal HttpMessage CreateListByElasticPoolRequest(string subscriptionId, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/elasticPools/", false); - uri.AppendPath(elasticPoolName, true); - uri.AppendPath("/databases", false); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/export", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(exportDatabaseDefinition); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets a list of databases in an elastic pool. + /// Exports a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the elastic pool. + /// The name of the database. + /// The database export request parameters. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByElasticPoolAsync(string subscriptionId, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task ExportAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(elasticPoolName, nameof(elasticPoolName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); - using var message = CreateListByElasticPoolRequest(subscriptionId, resourceGroupName, serverName, elasticPoolName); + using var message = CreateExportRequest(subscriptionId, resourceGroupName, serverName, databaseName, exportDatabaseDefinition); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - DatabaseListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets a list of databases in an elastic pool. + /// Exports a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the elastic pool. + /// The name of the database. + /// The database export request parameters. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByElasticPool(string subscriptionId, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Export(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(elasticPoolName, nameof(elasticPoolName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); - using var message = CreateListByElasticPoolRequest(subscriptionId, resourceGroupName, serverName, elasticPoolName); + using var message = CreateExportRequest(subscriptionId, resourceGroupName, serverName, databaseName, exportDatabaseDefinition); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - DatabaseListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -799,11 +799,11 @@ public Response Failover(string subscriptionId, string resourceGroupName, string } } - internal HttpMessage CreateListInaccessibleByServerRequest(string subscriptionId, string resourceGroupName, string serverName) + internal HttpMessage CreateImportRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition importExistingDatabaseDefinition) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -812,73 +812,79 @@ internal HttpMessage CreateListInaccessibleByServerRequest(string subscriptionId uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/inaccessibleDatabases", false); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/import", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(importExistingDatabaseDefinition); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets a list of inaccessible databases in a logical server. + /// Imports a bacpac into a new database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the database. + /// The database import request parameters. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListInaccessibleByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task ImportAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); - using var message = CreateListInaccessibleByServerRequest(subscriptionId, resourceGroupName, serverName); + using var message = CreateImportRequest(subscriptionId, resourceGroupName, serverName, databaseName, importExistingDatabaseDefinition); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - DatabaseListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets a list of inaccessible databases in a logical server. + /// Imports a bacpac into a new database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the database. + /// The database import request parameters. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListInaccessibleByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Import(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); - using var message = CreateListInaccessibleByServerRequest(subscriptionId, resourceGroupName, serverName); + using var message = CreateImportRequest(subscriptionId, resourceGroupName, serverName, databaseName, importExistingDatabaseDefinition); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - DatabaseListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreatePauseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateRenameRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition resourceMoveDefinition) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -893,69 +899,74 @@ internal HttpMessage CreatePauseRequest(string subscriptionId, string resourceGr uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/pause", false); + uri.AppendPath("/move", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(resourceMoveDefinition); + request.Content = content; _userAgent.Apply(message); return message; } - /// Pauses a database. + /// Renames a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be paused. + /// The name of the database to rename. + /// The resource move definition for renaming this database. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task PauseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task RenameAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition resourceMoveDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(resourceMoveDefinition, nameof(resourceMoveDefinition)); - using var message = CreatePauseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateRenameRequest(subscriptionId, resourceGroupName, serverName, databaseName, resourceMoveDefinition); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Pauses a database. + /// Renames a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be paused. + /// The name of the database to rename. + /// The resource move definition for renaming this database. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Pause(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Rename(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition resourceMoveDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(resourceMoveDefinition, nameof(resourceMoveDefinition)); - using var message = CreatePauseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateRenameRequest(subscriptionId, resourceGroupName, serverName, databaseName, resourceMoveDefinition); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateResumeRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreatePauseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -970,7 +981,7 @@ internal HttpMessage CreateResumeRequest(string subscriptionId, string resourceG uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/resume", false); + uri.AppendPath("/pause", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -978,22 +989,22 @@ internal HttpMessage CreateResumeRequest(string subscriptionId, string resourceG return message; } - /// Resumes a database. + /// Pauses a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be resumed. + /// The name of the database to be paused. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task ResumeAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task PauseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateResumeRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreatePauseRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1005,22 +1016,22 @@ public async Task ResumeAsync(string subscriptionId, string resourceGr } } - /// Resumes a database. + /// Pauses a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be resumed. + /// The name of the database to be paused. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Resume(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Pause(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateResumeRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreatePauseRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1032,7 +1043,7 @@ public Response Resume(string subscriptionId, string resourceGroupName, string s } } - internal HttpMessage CreateUpgradeDataWarehouseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateResumeRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1047,29 +1058,30 @@ internal HttpMessage CreateUpgradeDataWarehouseRequest(string subscriptionId, st uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/upgradeDataWarehouse", false); + uri.AppendPath("/resume", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Upgrades a data warehouse. + /// Resumes a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be upgraded. + /// The name of the database to be resumed. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task UpgradeDataWarehouseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task ResumeAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateUpgradeDataWarehouseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateResumeRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1081,22 +1093,22 @@ public async Task UpgradeDataWarehouseAsync(string subscriptionId, str } } - /// Upgrades a data warehouse. + /// Resumes a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be upgraded. + /// The name of the database to be resumed. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response UpgradeDataWarehouse(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Resume(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateUpgradeDataWarehouseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateResumeRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1108,7 +1120,7 @@ public Response UpgradeDataWarehouse(string subscriptionId, string resourceGroup } } - internal HttpMessage CreateRenameRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition resourceMoveDefinition) + internal HttpMessage CreateUpgradeDataWarehouseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1123,78 +1135,72 @@ internal HttpMessage CreateRenameRequest(string subscriptionId, string resourceG uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/move", false); + uri.AppendPath("/upgradeDataWarehouse", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(resourceMoveDefinition); - request.Content = content; _userAgent.Apply(message); return message; } - /// Renames a database. + /// Upgrades a data warehouse. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to rename. - /// The resource move definition for renaming this database. + /// The name of the database to be upgraded. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task RenameAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition resourceMoveDefinition, CancellationToken cancellationToken = default) + public async Task UpgradeDataWarehouseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(resourceMoveDefinition, nameof(resourceMoveDefinition)); - using var message = CreateRenameRequest(subscriptionId, resourceGroupName, serverName, databaseName, resourceMoveDefinition); + using var message = CreateUpgradeDataWarehouseRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Renames a database. + /// Upgrades a data warehouse. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to rename. - /// The resource move definition for renaming this database. + /// The name of the database to be upgraded. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Rename(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition resourceMoveDefinition, CancellationToken cancellationToken = default) + public Response UpgradeDataWarehouse(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(resourceMoveDefinition, nameof(resourceMoveDefinition)); - using var message = CreateRenameRequest(subscriptionId, resourceGroupName, serverName, databaseName, resourceMoveDefinition); + using var message = CreateUpgradeDataWarehouseRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateImportRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition importExistingDatabaseDefinition) + internal HttpMessage CreateListByElasticPoolRequest(string subscriptionId, string resourceGroupName, string serverName, string elasticPoolName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -1203,83 +1209,83 @@ internal HttpMessage CreateImportRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/import", false); + uri.AppendPath("/elasticPools/", false); + uri.AppendPath(elasticPoolName, true); + uri.AppendPath("/databases", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(importExistingDatabaseDefinition); - request.Content = content; _userAgent.Apply(message); return message; } - /// Imports a bacpac into a new database. + /// Gets a list of databases in an elastic pool. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The database import request parameters. + /// The name of the elastic pool. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task ImportAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByElasticPoolAsync(string subscriptionId, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); + Argument.AssertNotNullOrEmpty(elasticPoolName, nameof(elasticPoolName)); - using var message = CreateImportRequest(subscriptionId, resourceGroupName, serverName, databaseName, importExistingDatabaseDefinition); + using var message = CreateListByElasticPoolRequest(subscriptionId, resourceGroupName, serverName, elasticPoolName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + DatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Imports a bacpac into a new database. + /// Gets a list of databases in an elastic pool. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The database import request parameters. + /// The name of the elastic pool. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Import(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByElasticPool(string subscriptionId, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); + Argument.AssertNotNullOrEmpty(elasticPoolName, nameof(elasticPoolName)); - using var message = CreateImportRequest(subscriptionId, resourceGroupName, serverName, databaseName, importExistingDatabaseDefinition); + using var message = CreateListByElasticPoolRequest(subscriptionId, resourceGroupName, serverName, elasticPoolName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + DatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateExportRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition exportDatabaseDefinition) + internal HttpMessage CreateListInaccessibleByServerRequest(string subscriptionId, string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -1288,73 +1294,67 @@ internal HttpMessage CreateExportRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/export", false); + uri.AppendPath("/inaccessibleDatabases", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(exportDatabaseDefinition); - request.Content = content; _userAgent.Apply(message); return message; } - /// Exports a database. + /// Gets a list of inaccessible databases in a logical server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The database export request parameters. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task ExportAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListInaccessibleByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); - using var message = CreateExportRequest(subscriptionId, resourceGroupName, serverName, databaseName, exportDatabaseDefinition); + using var message = CreateListInaccessibleByServerRequest(subscriptionId, resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + DatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Exports a database. + /// Gets a list of inaccessible databases in a logical server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The database export request parameters. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Export(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListInaccessibleByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); - using var message = CreateExportRequest(subscriptionId, resourceGroupName, serverName, databaseName, exportDatabaseDefinition); + using var message = CreateListInaccessibleByServerRequest(subscriptionId, resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + DatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs new file mode 100644 index 000000000000..0f518f3fe12a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs @@ -0,0 +1,530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DistributedAvailabilityGroupsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DistributedAvailabilityGroupsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public DistributedAvailabilityGroupsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2021-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByInstanceRequest(string subscriptionId, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of a distributed availability groups in instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DistributedAvailabilityGroupsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DistributedAvailabilityGroupsListResult.DeserializeDistributedAvailabilityGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of a distributed availability groups in instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DistributedAvailabilityGroupsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DistributedAvailabilityGroupsListResult.DeserializeDistributedAvailabilityGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a distributed availability group info. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DistributedAvailabilityGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DistributedAvailabilityGroupData.DeserializeDistributedAvailabilityGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DistributedAvailabilityGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a distributed availability group info. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DistributedAvailabilityGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DistributedAvailabilityGroupData.DeserializeDistributedAvailabilityGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DistributedAvailabilityGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a distributed availability group replication mode. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a distributed availability group replication mode. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstanceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of a distributed availability groups in instance. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DistributedAvailabilityGroupsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DistributedAvailabilityGroupsListResult.DeserializeDistributedAvailabilityGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of a distributed availability groups in instance. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DistributedAvailabilityGroupsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DistributedAvailabilityGroupsListResult.DeserializeDistributedAvailabilityGroupsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ElasticPoolsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ElasticPoolsRestOperations.cs index 4fac876dcc11..08ef9a2dd04c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ElasticPoolsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ElasticPoolsRestOperations.cs @@ -212,7 +212,7 @@ public Response ListMetricDefinitions(string subscri } } - internal HttpMessage CreateListByServerRequest(string subscriptionId, string resourceGroupName, string serverName, int? skip) + internal HttpMessage CreateListByServerRequest(string subscriptionId, string resourceGroupName, string serverName, long? skip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -245,7 +245,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, int? skip = null, CancellationToken cancellationToken = default) + public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, long? skip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -275,7 +275,7 @@ public async Task> ListByServerAsync(string subs /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, int? skip = null, CancellationToken cancellationToken = default) + public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, long? skip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -708,7 +708,7 @@ public Response Failover(string subscriptionId, string resourceGroupName, string } } - internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName, int? skip) + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName, long? skip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -731,7 +731,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByServerNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, int? skip = null, CancellationToken cancellationToken = default) + public async Task> ListByServerNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, long? skip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -763,7 +763,7 @@ public async Task> ListByServerNextPageAsync(str /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListByServerNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, int? skip = null, CancellationToken cancellationToken = default) + public Response ListByServerNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, long? skip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/EndpointCertificatesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/EndpointCertificatesRestOperations.cs new file mode 100644 index 000000000000..0f05a84bc398 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/EndpointCertificatesRestOperations.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class EndpointCertificatesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EndpointCertificatesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public EndpointCertificatesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2021-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByInstanceRequest(string subscriptionId, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/endpointCertificates", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List certificates used on endpoints on the target instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EndpointCertificateListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EndpointCertificateListResult.DeserializeEndpointCertificateListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List certificates used on endpoints on the target instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EndpointCertificateListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EndpointCertificateListResult.DeserializeEndpointCertificateListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string endpointType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/endpointCertificates/", false); + uri.AppendPath(endpointType, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a certificate used on the endpoint with the given id. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, endpointType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EndpointCertificateData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EndpointCertificateData.DeserializeEndpointCertificateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EndpointCertificateData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a certificate used on the endpoint with the given id. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, endpointType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EndpointCertificateData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EndpointCertificateData.DeserializeEndpointCertificateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EndpointCertificateData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstanceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List certificates used on endpoints on the target instance. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EndpointCertificateListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EndpointCertificateListResult.DeserializeEndpointCertificateListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List certificates used on endpoints on the target instance. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EndpointCertificateListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EndpointCertificateListResult.DeserializeEndpointCertificateListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/IPv6FirewallRulesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/IPv6FirewallRulesRestOperations.cs new file mode 100644 index 000000000000..936a0a6e9aeb --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/IPv6FirewallRulesRestOperations.cs @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class IPv6FirewallRulesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of IPv6FirewallRulesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public IPv6FirewallRulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2021-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServerRequest(string subscriptionId, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/ipv6FirewallRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of IPv6 firewall rules. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IPv6FirewallRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IPv6FirewallRuleListResult.DeserializeIPv6FirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of IPv6 firewall rules. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IPv6FirewallRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IPv6FirewallRuleListResult.DeserializeIPv6FirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/ipv6FirewallRules/", false); + uri.AppendPath(firewallRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets an IPv6 firewall rule. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IPv6FirewallRuleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IPv6FirewallRuleData.DeserializeIPv6FirewallRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((IPv6FirewallRuleData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets an IPv6 firewall rule. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IPv6FirewallRuleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IPv6FirewallRuleData.DeserializeIPv6FirewallRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((IPv6FirewallRuleData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRuleData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/ipv6FirewallRules/", false); + uri.AppendPath(firewallRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates an IPv6 firewall rule. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + IPv6FirewallRuleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IPv6FirewallRuleData.DeserializeIPv6FirewallRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates an IPv6 firewall rule. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + IPv6FirewallRuleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IPv6FirewallRuleData.DeserializeIPv6FirewallRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/ipv6FirewallRules/", false); + uri.AppendPath(firewallRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Deletes an IPv6 firewall rule. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes an IPv6 firewall rule. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of IPv6 firewall rules. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServerNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var message = CreateListByServerNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IPv6FirewallRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IPv6FirewallRuleListResult.DeserializeIPv6FirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of IPv6 firewall rules. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServerNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var message = CreateListByServerNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IPv6FirewallRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IPv6FirewallRuleListResult.DeserializeIPv6FirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs index 6f7a1461226f..9f67316848d1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs @@ -33,7 +33,7 @@ public LongTermRetentionBackupsRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs index 2dcead733aeb..7086042a328a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs @@ -33,7 +33,7 @@ public LongTermRetentionManagedInstanceBackupsRestOperations(HttpPipeline pipeli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs index aa191f0be0be..6938e21bc0a4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs @@ -33,7 +33,7 @@ public ManagedInstancesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs deleted file mode 100644 index 8b4c4fc088d3..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - internal partial class OperationsHealthRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of OperationsHealthRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public OperationsHealthRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal HttpMessage CreateListByLocationRequest(string subscriptionId, string locationName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Sql/locations/", false); - uri.AppendPath(locationName, true); - uri.AppendPath("/operationsHealth", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a service operation health status. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByLocationAsync(string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationRequest(subscriptionId, locationName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a service operation health status. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByLocation(string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationRequest(subscriptionId, locationName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string subscriptionId, string locationName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a service operation health status. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByLocationNextPageAsync(string nextLink, string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationNextPageRequest(nextLink, subscriptionId, locationName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a service operation health status. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByLocationNextPage(string nextLink, string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationNextPageRequest(nextLink, subscriptionId, locationName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs index 169e786237aa..13e6b7e9d8cc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableDroppedDatabasesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-02-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs index 0665a5fbef06..4df153191bc2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableDroppedManagedDatabasesRestOperations(HttpPipeline pipeline, st { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-02-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerTrustCertificatesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerTrustCertificatesRestOperations.cs new file mode 100644 index 000000000000..dc8af257e202 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerTrustCertificatesRestOperations.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ServerTrustCertificatesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ServerTrustCertificatesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ServerTrustCertificatesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2021-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByInstanceRequest(string subscriptionId, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/serverTrustCertificates", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of server trust certificates that were uploaded from box to the given Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustCertificatesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustCertificatesListResult.DeserializeServerTrustCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of server trust certificates that were uploaded from box to the given Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustCertificatesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustCertificatesListResult.DeserializeServerTrustCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/serverTrustCertificates/", false); + uri.AppendPath(certificateName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustCertificateData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustCertificateData.DeserializeServerTrustCertificateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ServerTrustCertificateData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustCertificateData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustCertificateData.DeserializeServerTrustCertificateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ServerTrustCertificateData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, ServerTrustCertificateData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/serverTrustCertificates/", false); + uri.AppendPath(certificateName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Name of of the certificate to upload. + /// The server trust certificate info. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, ServerTrustCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Name of of the certificate to upload. + /// The server trust certificate info. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, ServerTrustCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/serverTrustCertificates/", false); + uri.AppendPath(certificateName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Name of of the certificate to delete. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// Name of of the certificate to delete. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstanceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of server trust certificates that were uploaded from box to the given Sql Managed Instance. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustCertificatesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustCertificatesListResult.DeserializeServerTrustCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of server trust certificates that were uploaded from box to the given Sql Managed Instance. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustCertificatesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustCertificatesListResult.DeserializeServerTrustCertificatesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs index afe9269c1edb..4191eee8f532 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs @@ -32,19 +32,17 @@ public RestorableDroppedDatabaseData() /// Resource tags. /// The name of the database. /// The max size of the database expressed in bytes. - /// DEPRECATED: The resource name of the elastic pool containing this database. This property is deprecated and the value will always be null. /// The creation date of the database (ISO8601 format). /// The deletion date of the database (ISO8601 format). /// The earliest restore date of the database (ISO8601 format). /// The storage account type used to store backups for this database. - internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SqlSku sku, string location, IDictionary tags, string databaseName, long? maxSizeBytes, string elasticPoolId, DateTimeOffset? creationOn, DateTimeOffset? deletionOn, DateTimeOffset? earliestRestoreOn, RestorableDroppedDatabasePropertiesBackupStorageRedundancy? backupStorageRedundancy) : base(id, name, resourceType, systemData) + internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SqlSku sku, string location, IDictionary tags, string databaseName, long? maxSizeBytes, DateTimeOffset? creationOn, DateTimeOffset? deletionOn, DateTimeOffset? earliestRestoreOn, BackupStorageRedundancy? backupStorageRedundancy) : base(id, name, resourceType, systemData) { Sku = sku; Location = location; Tags = tags; DatabaseName = databaseName; MaxSizeBytes = maxSizeBytes; - ElasticPoolId = elasticPoolId; CreationOn = creationOn; DeletionOn = deletionOn; EarliestRestoreOn = earliestRestoreOn; @@ -61,8 +59,6 @@ internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, Resou public string DatabaseName { get; } /// The max size of the database expressed in bytes. public long? MaxSizeBytes { get; } - /// DEPRECATED: The resource name of the elastic pool containing this database. This property is deprecated and the value will always be null. - public string ElasticPoolId { get; } /// The creation date of the database (ISO8601 format). public DateTimeOffset? CreationOn { get; } /// The deletion date of the database (ISO8601 format). @@ -70,6 +66,6 @@ internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, Resou /// The earliest restore date of the database (ISO8601 format). public DateTimeOffset? EarliestRestoreOn { get; } /// The storage account type used to store backups for this database. - public RestorableDroppedDatabasePropertiesBackupStorageRedundancy? BackupStorageRedundancy { get; } + public BackupStorageRedundancy? BackupStorageRedundancy { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateCollection.cs new file mode 100644 index 000000000000..644fc88827d1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateCollection.cs @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServerTrustCertificates method from an instance of . + /// + public partial class ServerTrustCertificateCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serverTrustCertificateClientDiagnostics; + private readonly ServerTrustCertificatesRestOperations _serverTrustCertificateRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServerTrustCertificateCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServerTrustCertificateCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serverTrustCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ServerTrustCertificateResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServerTrustCertificateResource.ResourceType, out string serverTrustCertificateApiVersion); + _serverTrustCertificateRestClient = new ServerTrustCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serverTrustCertificateApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstanceResource.ResourceType), nameof(id)); + } + + /// + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of of the certificate to upload. + /// The server trust certificate info. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string certificateName, ServerTrustCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ServerTrustCertificateOperationSource(Client), _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of of the certificate to upload. + /// The server trust certificate info. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string certificateName, ServerTrustCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, data, cancellationToken); + var operation = new SqlArmOperation(new ServerTrustCertificateOperationSource(Client), _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.Get"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.Get"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of server trust certificates that were uploaded from box to the given Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates + /// Operation Id: ServerTrustCertificates_ListByInstance + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.ListByInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a list of server trust certificates that were uploaded from box to the given Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates + /// Operation Id: ServerTrustCertificates_ListByInstance + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.GetAll"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustCertificateResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.Exists"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.Exists"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateData.cs new file mode 100644 index 000000000000..926f0ced99f9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing the ServerTrustCertificate data model. + public partial class ServerTrustCertificateData : ResourceData + { + /// Initializes a new instance of ServerTrustCertificateData. + public ServerTrustCertificateData() + { + } + + /// Initializes a new instance of ServerTrustCertificateData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The certificate public blob. + /// The certificate thumbprint. + /// The certificate name. + internal ServerTrustCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string publicBlob, string thumbprint, string certificateName) : base(id, name, resourceType, systemData) + { + PublicBlob = publicBlob; + Thumbprint = thumbprint; + CertificateName = certificateName; + } + + /// The certificate public blob. + public string PublicBlob { get; set; } + /// The certificate thumbprint. + public string Thumbprint { get; } + /// The certificate name. + public string CertificateName { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateResource.cs new file mode 100644 index 000000000000..7a5532b4e166 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateResource.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing a ServerTrustCertificate along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServerTrustCertificateResource method. + /// Otherwise you can get one from its parent resource using the GetServerTrustCertificate method. + /// + public partial class ServerTrustCertificateResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serverTrustCertificateClientDiagnostics; + private readonly ServerTrustCertificatesRestOperations _serverTrustCertificateRestClient; + private readonly ServerTrustCertificateData _data; + + /// Initializes a new instance of the class for mocking. + protected ServerTrustCertificateResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServerTrustCertificateResource(ArmClient client, ServerTrustCertificateData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServerTrustCertificateResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serverTrustCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serverTrustCertificateApiVersion); + _serverTrustCertificateRestClient = new ServerTrustCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serverTrustCertificateApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/managedInstances/serverTrustCertificates"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ServerTrustCertificateData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateResource.Get"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateResource.Get"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateResource.Delete"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateResource.Delete"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(_serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The server trust certificate info. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ServerTrustCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateResource.Update"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ServerTrustCertificateOperationSource(Client), _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// Operation Id: ServerTrustCertificates_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The server trust certificate info. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ServerTrustCertificateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateResource.Update"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new SqlArmOperation(new ServerTrustCertificateOperationSource(Client), _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseData.cs index e8f804ad12e9..1686ee609613 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseData.cs @@ -45,6 +45,7 @@ public SqlDatabaseData(AzureLocation location) : base(location) /// /// Kind of database. This is metadata used for the Azure portal experience. /// Resource that manages the database. + /// The Azure Active Directory identity of the database. /// /// Specifies the mode of database creation. /// @@ -87,8 +88,8 @@ public SqlDatabaseData(AzureLocation location) : base(location) /// The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. /// The max log size for this database. /// This records the earliest start date and time that restore is available for this database (ISO8601 format). - /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. - /// The number of secondary replicas associated with the database that are used to provide high availability. + /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. + /// The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. /// The secondary type of the database if it is a secondary. Valid values are Geo and Named. /// The name and tier of the SKU. /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. @@ -100,11 +101,28 @@ public SqlDatabaseData(AzureLocation location) : base(location) /// Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. /// Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created. /// Infra encryption is enabled for this database. - internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, string kind, string managedBy, CreateMode? createMode, string collation, long? maxSizeBytes, SampleSchemaName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationOn, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInOn, DateTimeOffset? sourceDatabaseDeletionOn, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreOn, DatabaseReadScale? readScale, int? highAvailabilityReplicaCount, SecondaryType? secondaryType, SqlSku currentSku, int? autoPauseDelay, CurrentBackupStorageRedundancy? currentBackupStorageRedundancy, RequestedBackupStorageRedundancy? requestedBackupStorageRedundancy, double? minCapacity, DateTimeOffset? pausedOn, DateTimeOffset? resumedOn, string maintenanceConfigurationId, bool? isLedgerOn, bool? isInfraEncryptionEnabled) : base(id, name, resourceType, systemData, tags, location) + /// The Client id used for cross tenant per database CMK scenario. + /// + /// The resource identifier of the source associated with the create operation of this database. + /// + /// When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + /// + /// When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or existing sql pool, and restorePointInTime must be specified. + /// + /// When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. + /// + /// When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. + /// + /// This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + /// + /// When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + /// + internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, string kind, string managedBy, DatabaseIdentity identity, CreateMode? createMode, string collation, long? maxSizeBytes, SampleSchemaName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationOn, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInOn, DateTimeOffset? sourceDatabaseDeletionOn, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreOn, DatabaseReadScale? readScale, int? highAvailabilityReplicaCount, SecondaryType? secondaryType, SqlSku currentSku, int? autoPauseDelay, BackupStorageRedundancy? currentBackupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy, double? minCapacity, DateTimeOffset? pausedOn, DateTimeOffset? resumedOn, string maintenanceConfigurationId, bool? isLedgerOn, bool? isInfraEncryptionEnabled, Guid? federatedClientId, string sourceResourceId) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Kind = kind; ManagedBy = managedBy; + Identity = identity; CreateMode = createMode; Collation = collation; MaxSizeBytes = maxSizeBytes; @@ -142,6 +160,8 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour MaintenanceConfigurationId = maintenanceConfigurationId; IsLedgerOn = isLedgerOn; IsInfraEncryptionEnabled = isInfraEncryptionEnabled; + FederatedClientId = federatedClientId; + SourceResourceId = sourceResourceId; } /// @@ -163,6 +183,8 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour public string Kind { get; } /// Resource that manages the database. public string ManagedBy { get; } + /// The Azure Active Directory identity of the database. + public DatabaseIdentity Identity { get; set; } /// /// Specifies the mode of database creation. /// @@ -229,9 +251,9 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour public long? MaxLogSizeBytes { get; } /// This records the earliest start date and time that restore is available for this database (ISO8601 format). public DateTimeOffset? EarliestRestoreOn { get; } - /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. + /// The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. public DatabaseReadScale? ReadScale { get; set; } - /// The number of secondary replicas associated with the database that are used to provide high availability. + /// The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. public int? HighAvailabilityReplicaCount { get; set; } /// The secondary type of the database if it is a secondary. Valid values are Geo and Named. public SecondaryType? SecondaryType { get; set; } @@ -240,9 +262,9 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. public int? AutoPauseDelay { get; set; } /// The storage account type used to store backups for this database. - public CurrentBackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } /// The storage account type to be used to store backups for this database. - public RequestedBackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Minimal capacity that database will always have allocated, if not paused. public double? MinCapacity { get; set; } /// The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. @@ -255,5 +277,23 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour public bool? IsLedgerOn { get; set; } /// Infra encryption is enabled for this database. public bool? IsInfraEncryptionEnabled { get; } + /// The Client id used for cross tenant per database CMK scenario. + public Guid? FederatedClientId { get; set; } + /// + /// The resource identifier of the source associated with the create operation of this database. + /// + /// When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + /// + /// When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or existing sql pool, and restorePointInTime must be specified. + /// + /// When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. + /// + /// When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. + /// + /// This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + /// + /// When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + /// + public string SourceResourceId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs index 531c8cf6fb8d..1966f6fa4a4a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs @@ -40,14 +40,14 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly DatabaseColumnsRestOperations _serverDatabaseSchemaTableColumnDatabaseColumnsRestClient; private readonly ClientDiagnostics _restorePointClientDiagnostics; private readonly RestorePointsRestOperations _restorePointRestClient; - private readonly ClientDiagnostics _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics; - private readonly SensitivityLabelsRestOperations _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient; private readonly ClientDiagnostics _databaseExtensionsClientDiagnostics; private readonly DatabaseExtensionsRestOperations _databaseExtensionsRestClient; private readonly ClientDiagnostics _databaseOperationsClientDiagnostics; private readonly DatabaseRestOperations _databaseOperationsRestClient; private readonly ClientDiagnostics _databaseUsagesClientDiagnostics; private readonly DatabaseUsagesRestOperations _databaseUsagesRestClient; + private readonly ClientDiagnostics _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics; + private readonly SensitivityLabelsRestOperations _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient; private readonly SqlDatabaseData _data; /// Initializes a new instance of the class for mocking. @@ -78,15 +78,15 @@ internal SqlDatabaseResource(ArmClient client, ResourceIdentifier id) : base(cli _restorePointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", RestorePointResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(RestorePointResource.ResourceType, out string restorePointApiVersion); _restorePointRestClient = new RestorePointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, restorePointApiVersion); - _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType, out string serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); - _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient = new SensitivityLabelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); _databaseExtensionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseExtensionsRestClient = new DatabaseExtensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _databaseOperationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseOperationsRestClient = new DatabaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _databaseUsagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseUsagesRestClient = new DatabaseUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType, out string serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); + _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient = new SensitivityLabelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -973,74 +973,24 @@ Page FirstPageFunc(int? pageSizeHint) } /// - /// Failovers a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover - /// Operation Id: Databases_Failover - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The type of replica to be failed over. - /// The cancellation token to use. - public virtual async Task FailoverAsync(WaitUntil waitUntil, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) - { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Failover"); - scope.Start(); - try - { - var response = await _sqlDatabaseDatabasesRestClient.FailoverAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Failovers a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover - /// Operation Id: Databases_Failover + /// Exports a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export + /// Operation Id: Databases_Export /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The type of replica to be failed over. + /// The database export request parameters. /// The cancellation token to use. - public virtual ArmOperation Failover(WaitUntil waitUntil, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> ExportAsync(WaitUntil waitUntil, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Failover"); - scope.Start(); - try - { - var response = _sqlDatabaseDatabasesRestClient.Failover(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType, cancellationToken); - var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } + Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); - /// - /// Pauses a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause - /// Operation Id: Databases_Pause - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task> PauseAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Pause"); + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Export"); scope.Start(); try { - var response = await _sqlDatabaseDatabasesRestClient.PauseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreatePauseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _sqlDatabaseDatabasesRestClient.ExportAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateExportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1053,20 +1003,24 @@ public virtual async Task> PauseAsync(WaitUnti } /// - /// Pauses a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause - /// Operation Id: Databases_Pause + /// Exports a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export + /// Operation Id: Databases_Export /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The database export request parameters. /// The cancellation token to use. - public virtual ArmOperation Pause(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Export(WaitUntil waitUntil, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Pause"); + Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); + + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Export"); scope.Start(); try { - var response = _sqlDatabaseDatabasesRestClient.Pause(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreatePauseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _sqlDatabaseDatabasesRestClient.Export(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition, cancellationToken); + var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateExportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1079,22 +1033,23 @@ public virtual ArmOperation Pause(WaitUntil waitUntil, Canc } /// - /// Resumes a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume - /// Operation Id: Databases_Resume + /// Failovers a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover + /// Operation Id: Databases_Failover /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The type of replica to be failed over. /// The cancellation token to use. - public virtual async Task> ResumeAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task FailoverAsync(WaitUntil waitUntil, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Resume"); + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Failover"); scope.Start(); try { - var response = await _sqlDatabaseDatabasesRestClient.ResumeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateResumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _sqlDatabaseDatabasesRestClient.FailoverAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -1105,22 +1060,23 @@ public virtual async Task> ResumeAsync(WaitUnt } /// - /// Resumes a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume - /// Operation Id: Databases_Resume + /// Failovers a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover + /// Operation Id: Databases_Failover /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The type of replica to be failed over. /// The cancellation token to use. - public virtual ArmOperation Resume(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Failover(WaitUntil waitUntil, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Resume"); + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Failover"); scope.Start(); try { - var response = _sqlDatabaseDatabasesRestClient.Resume(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateResumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _sqlDatabaseDatabasesRestClient.Failover(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType, cancellationToken); + var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaType).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -1131,22 +1087,26 @@ public virtual ArmOperation Resume(WaitUntil waitUntil, Can } /// - /// Upgrades a data warehouse. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse - /// Operation Id: Databases_UpgradeDataWarehouse + /// Imports a bacpac into a new database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import + /// Operation Id: Databases_Import /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The database import request parameters. /// The cancellation token to use. - public virtual async Task UpgradeDataWarehouseAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> ImportAsync(WaitUntil waitUntil, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.UpgradeDataWarehouse"); + Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); + + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Import"); scope.Start(); try { - var response = await _sqlDatabaseDatabasesRestClient.UpgradeDataWarehouseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateUpgradeDataWarehouseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _sqlDatabaseDatabasesRestClient.ImportAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateImportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -1157,22 +1117,26 @@ public virtual async Task UpgradeDataWarehouseAsync(WaitUntil wait } /// - /// Upgrades a data warehouse. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse - /// Operation Id: Databases_UpgradeDataWarehouse + /// Imports a bacpac into a new database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import + /// Operation Id: Databases_Import /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The database import request parameters. /// The cancellation token to use. - public virtual ArmOperation UpgradeDataWarehouse(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Import(WaitUntil waitUntil, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) { - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.UpgradeDataWarehouse"); + Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); + + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Import"); scope.Start(); try { - var response = _sqlDatabaseDatabasesRestClient.UpgradeDataWarehouse(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateUpgradeDataWarehouseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _sqlDatabaseDatabasesRestClient.Import(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition, cancellationToken); + var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateImportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) @@ -1235,24 +1199,20 @@ public virtual Response Rename(ResourceMoveDefinition resourceMoveDefinition, Ca } /// - /// Imports a bacpac into a new database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import - /// Operation Id: Databases_Import + /// Pauses a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause + /// Operation Id: Databases_Pause /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The database import request parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> ImportAsync(WaitUntil waitUntil, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) + public virtual async Task> PauseAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); - - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Import"); + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Pause"); scope.Start(); try { - var response = await _sqlDatabaseDatabasesRestClient.ImportAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateImportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition).Request, response, OperationFinalStateVia.Location); + var response = await _sqlDatabaseDatabasesRestClient.PauseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreatePauseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1265,24 +1225,20 @@ public virtual async Task> ImportAsync } /// - /// Imports a bacpac into a new database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import - /// Operation Id: Databases_Import + /// Pauses a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause + /// Operation Id: Databases_Pause /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The database import request parameters. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Import(WaitUntil waitUntil, ImportExistingDatabaseDefinition importExistingDatabaseDefinition, CancellationToken cancellationToken = default) + public virtual ArmOperation Pause(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(importExistingDatabaseDefinition, nameof(importExistingDatabaseDefinition)); - - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Import"); + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Pause"); scope.Start(); try { - var response = _sqlDatabaseDatabasesRestClient.Import(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition, cancellationToken); - var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateImportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, importExistingDatabaseDefinition).Request, response, OperationFinalStateVia.Location); + var response = _sqlDatabaseDatabasesRestClient.Pause(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreatePauseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1295,24 +1251,20 @@ public virtual ArmOperation Import(WaitUntil waitUn } /// - /// Exports a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export - /// Operation Id: Databases_Export + /// Resumes a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume + /// Operation Id: Databases_Resume /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The database export request parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> ExportAsync(WaitUntil waitUntil, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) + public virtual async Task> ResumeAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); - - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Export"); + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Resume"); scope.Start(); try { - var response = await _sqlDatabaseDatabasesRestClient.ExportAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateExportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition).Request, response, OperationFinalStateVia.Location); + var response = await _sqlDatabaseDatabasesRestClient.ResumeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateResumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1325,24 +1277,20 @@ public virtual async Task> ExportAsync } /// - /// Exports a database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export - /// Operation Id: Databases_Export + /// Resumes a database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume + /// Operation Id: Databases_Resume /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The database export request parameters. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Export(WaitUntil waitUntil, ExportDatabaseDefinition exportDatabaseDefinition, CancellationToken cancellationToken = default) + public virtual ArmOperation Resume(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(exportDatabaseDefinition, nameof(exportDatabaseDefinition)); - - using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Export"); + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.Resume"); scope.Start(); try { - var response = _sqlDatabaseDatabasesRestClient.Export(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition, cancellationToken); - var operation = new SqlArmOperation(new ImportExportOperationResultOperationSource(), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateExportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, exportDatabaseDefinition).Request, response, OperationFinalStateVia.Location); + var response = _sqlDatabaseDatabasesRestClient.Resume(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(new SqlDatabaseOperationSource(Client), _sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateResumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1355,15 +1303,67 @@ public virtual ArmOperation Export(WaitUntil waitUn } /// - /// List database columns - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/columns - /// Operation Id: DatabaseColumns_ListByDatabase + /// Upgrades a data warehouse. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse + /// Operation Id: Databases_UpgradeDataWarehouse /// - /// The ArrayOfGet3ItemsItem to use. - /// The ArrayOfGet4ItemsItem to use. - /// The ArrayOfGet5ItemsItem to use. - /// The ArrayOfGet6ItemsItem to use. - /// An opaque token that identifies a starting point in the collection. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task UpgradeDataWarehouseAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.UpgradeDataWarehouse"); + scope.Start(); + try + { + var response = await _sqlDatabaseDatabasesRestClient.UpgradeDataWarehouseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateUpgradeDataWarehouseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Upgrades a data warehouse. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse + /// Operation Id: Databases_UpgradeDataWarehouse + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation UpgradeDataWarehouse(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseResource.UpgradeDataWarehouse"); + scope.Start(); + try + { + var response = _sqlDatabaseDatabasesRestClient.UpgradeDataWarehouse(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(_sqlDatabaseDatabasesClientDiagnostics, Pipeline, _sqlDatabaseDatabasesRestClient.CreateUpgradeDataWarehouseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List database columns + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/columns + /// Operation Id: DatabaseColumns_ListByDatabase + /// + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetDatabaseColumnsAsync(IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) @@ -1509,25 +1509,88 @@ public virtual ArmOperation CreateRestorePoint(WaitUntil w } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_ListCurrentByDatabase + /// Perform a database extension operation, like polybase import + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} + /// Operation Id: DatabaseExtensions_CreateOrUpdate /// - /// The String to use. - /// The Boolean to use. - /// An OData filter expression that filters elements in the collection. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The database import request parameters. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCurrentSensitivityLabelsAsync(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateDatabaseExtensionAsync(WaitUntil waitUntil, string extensionName, DatabaseExtensions databaseExtensions, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + Argument.AssertNotNull(databaseExtensions, nameof(databaseExtensions)); + + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); + scope.Start(); + try { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + var response = await _databaseExtensionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Perform a database extension operation, like polybase import + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} + /// Operation Id: DatabaseExtensions_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The database import request parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdateDatabaseExtension(WaitUntil waitUntil, string extensionName, DatabaseExtensions databaseExtensions, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + Argument.AssertNotNull(databaseExtensions, nameof(databaseExtensions)); + + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); + scope.Start(); + try + { + var response = _databaseExtensionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions, cancellationToken); + var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List database extension. This will return an empty list as it is not supported. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions + /// Operation Id: DatabaseExtensions_ListByDatabase + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseExtensionsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseExtensionsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1535,14 +1598,14 @@ async Task> FirstP throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseExtensionsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1554,25 +1617,22 @@ async Task> NextPa } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_ListCurrentByDatabase + /// List database extension. This will return an empty list as it is not supported. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions + /// Operation Id: DatabaseExtensions_ListByDatabase /// - /// The String to use. - /// The Boolean to use. - /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCurrentSensitivityLabels(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseExtensions(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseExtensionsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1580,14 +1640,14 @@ Page FirstPageFunc(int? throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseExtensionsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1599,22 +1659,19 @@ Page NextPageFunc(strin } /// - /// Update sensitivity labels of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_Update + /// Cancels the asynchronous operation on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel + /// Operation Id: DatabaseOperations_Cancel /// - /// The SensitivityLabelUpdateList to use. + /// The operation identifier. /// The cancellation token to use. - /// is null. - public virtual async Task UpdateSensitivityLabelAsync(SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) + public virtual async Task CancelDatabaseOperationAsync(Guid operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sensitivityLabelUpdateList, cancellationToken).ConfigureAwait(false); + var response = await _databaseOperationsRestClient.CancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1625,22 +1682,19 @@ public virtual async Task UpdateSensitivityLabelAsync(SensitivityLabel } /// - /// Update sensitivity labels of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_Update + /// Cancels the asynchronous operation on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel + /// Operation Id: DatabaseOperations_Cancel /// - /// The SensitivityLabelUpdateList to use. + /// The operation identifier. /// The cancellation token to use. - /// is null. - public virtual Response UpdateSensitivityLabel(SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) + public virtual Response CancelDatabaseOperation(Guid operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sensitivityLabelUpdateList, cancellationToken); + var response = _databaseOperationsRestClient.Cancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); return response; } catch (Exception e) @@ -1651,25 +1705,22 @@ public virtual Response UpdateSensitivityLabel(SensitivityLabelUpdateList sensit } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_ListRecommendedByDatabase + /// Gets a list of operations performed on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations + /// Operation Id: DatabaseOperations_ListByDatabase /// - /// The String to use. - /// Specifies whether to include disabled recommendations or not. - /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRecommendedSensitivityLabelsAsync(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseOperationsAsync(CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseOperationsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1677,14 +1728,14 @@ async Task> FirstP throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseOperationsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1696,25 +1747,22 @@ async Task> NextPa } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_ListRecommendedByDatabase + /// Gets a list of operations performed on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations + /// Operation Id: DatabaseOperations_ListByDatabase /// - /// The String to use. - /// Specifies whether to include disabled recommendations or not. - /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRecommendedSensitivityLabels(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseOperations(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseOperationsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1722,14 +1770,14 @@ Page FirstPageFunc(int? throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseOperationsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1741,140 +1789,109 @@ Page NextPageFunc(strin } /// - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_UpdateRecommended - /// - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// is null. - public virtual async Task UpdateRecommendedSensitivityLabelAsync(RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); - scope.Start(); - try - { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommendedAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recommendedSensitivityLabelUpdateList, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_UpdateRecommended - /// - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// is null. - public virtual Response UpdateRecommendedSensitivityLabel(RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); - scope.Start(); - try - { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommended(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recommendedSensitivityLabelUpdateList, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Perform a database extension operation, like polybase import - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} - /// Operation Id: DatabaseExtensions_CreateOrUpdate + /// Gets database usages. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages + /// Operation Id: DatabaseUsages_ListByDatabase /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The String to use. - /// The database import request parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateDatabaseExtensionAsync(WaitUntil waitUntil, string extensionName, DatabaseExtensions databaseExtensions, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseUsagesAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); - Argument.AssertNotNull(databaseExtensions, nameof(databaseExtensions)); - - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); - scope.Start(); - try + async Task> FirstPageFunc(int? pageSizeHint) { - var response = await _databaseExtensionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = await _databaseUsagesRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = await _databaseUsagesRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// - /// Perform a database extension operation, like polybase import - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} - /// Operation Id: DatabaseExtensions_CreateOrUpdate + /// Gets database usages. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages + /// Operation Id: DatabaseUsages_ListByDatabase /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The String to use. - /// The database import request parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdateDatabaseExtension(WaitUntil waitUntil, string extensionName, DatabaseExtensions databaseExtensions, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseUsages(CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); - Argument.AssertNotNull(databaseExtensions, nameof(databaseExtensions)); - - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); - scope.Start(); - try + Page FirstPageFunc(int? pageSizeHint) { - var response = _databaseExtensionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions, cancellationToken); - var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, databaseExtensions).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = _databaseUsagesRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = _databaseUsagesRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// - /// List database extension. This will return an empty list as it is not supported. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions - /// Operation Id: DatabaseExtensions_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_ListCurrentByDatabase /// + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatabaseExtensionsAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCurrentSensitivityLabelsAsync(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = await _databaseExtensionsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1882,14 +1899,14 @@ async Task> FirstPageFunc(int? pageS throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = await _databaseExtensionsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1901,22 +1918,25 @@ async Task> NextPageFunc(string next } /// - /// List database extension. This will return an empty list as it is not supported. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions - /// Operation Id: DatabaseExtensions_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_ListCurrentByDatabase /// + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatabaseExtensions(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCurrentSensitivityLabels(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = _databaseExtensionsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1924,14 +1944,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = _databaseExtensionsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1943,19 +1963,22 @@ Page NextPageFunc(string nextLink, int? p } /// - /// Cancels the asynchronous operation on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel - /// Operation Id: DatabaseOperations_Cancel + /// Update sensitivity labels of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_Update /// - /// The operation identifier. + /// The SensitivityLabelUpdateList to use. /// The cancellation token to use. - public virtual async Task CancelDatabaseOperationAsync(Guid operationId, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task UpdateSensitivityLabelAsync(SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); + Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); scope.Start(); try { - var response = await _databaseOperationsRestClient.CancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sensitivityLabelUpdateList, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1966,19 +1989,22 @@ public virtual async Task CancelDatabaseOperationAsync(Guid operationI } /// - /// Cancels the asynchronous operation on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel - /// Operation Id: DatabaseOperations_Cancel + /// Update sensitivity labels of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_Update /// - /// The operation identifier. + /// The SensitivityLabelUpdateList to use. /// The cancellation token to use. - public virtual Response CancelDatabaseOperation(Guid operationId, CancellationToken cancellationToken = default) + /// is null. + public virtual Response UpdateSensitivityLabel(SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); + Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); scope.Start(); try { - var response = _databaseOperationsRestClient.Cancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sensitivityLabelUpdateList, cancellationToken); return response; } catch (Exception e) @@ -1989,22 +2015,25 @@ public virtual Response CancelDatabaseOperation(Guid operationId, CancellationTo } /// - /// Gets a list of operations performed on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations - /// Operation Id: DatabaseOperations_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_ListRecommendedByDatabase /// + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatabaseOperationsAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRecommendedSensitivityLabelsAsync(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = await _databaseOperationsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2012,14 +2041,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = await _databaseOperationsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2031,22 +2060,25 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH } /// - /// Gets a list of operations performed on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations - /// Operation Id: DatabaseOperations_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_ListRecommendedByDatabase /// + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatabaseOperations(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRecommendedSensitivityLabels(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = _databaseOperationsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2054,14 +2086,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = _databaseOperationsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2073,87 +2105,55 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets database usages. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages - /// Operation Id: DatabaseUsages_ListByDatabase + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_UpdateRecommended /// + /// The RecommendedSensitivityLabelUpdateList to use. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatabaseUsagesAsync(CancellationToken cancellationToken = default) + /// is null. + public virtual async Task UpdateRecommendedSensitivityLabelAsync(RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); + scope.Start(); + try { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); - scope.Start(); - try - { - var response = await _databaseUsagesRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommendedAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recommendedSensitivityLabelUpdateList, cancellationToken).ConfigureAwait(false); + return response; } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + catch (Exception e) { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); - scope.Start(); - try - { - var response = await _databaseUsagesRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + scope.Failed(e); + throw; } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// - /// Gets database usages. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages - /// Operation Id: DatabaseUsages_ListByDatabase + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_UpdateRecommended /// + /// The RecommendedSensitivityLabelUpdateList to use. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatabaseUsages(CancellationToken cancellationToken = default) + /// is null. + public virtual Response UpdateRecommendedSensitivityLabel(RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); + scope.Start(); + try { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); - scope.Start(); - try - { - var response = _databaseUsagesRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommended(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recommendedSensitivityLabelUpdateList, cancellationToken); + return response; } - Page NextPageFunc(string nextLink, int? pageSizeHint) + catch (Exception e) { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); - scope.Start(); - try - { - var response = _databaseUsagesRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + scope.Failed(e); + throw; } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs index 0fe2788c8bcc..b92609aa470f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs @@ -1054,6 +1054,43 @@ public virtual Response GetServerConnectionPolic return GetServerConnectionPolicies().Get(connectionPolicyName, cancellationToken); } + /// Gets a collection of IPv6FirewallRuleResources in the SqlServer. + /// An object representing collection of IPv6FirewallRuleResources and their operations over a IPv6FirewallRuleResource. + public virtual IPv6FirewallRuleCollection GetIPv6FirewallRules() + { + return GetCachedClient(Client => new IPv6FirewallRuleCollection(Client, Id)); + } + + /// + /// Gets an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetIPv6FirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + return await GetIPv6FirewallRules().GetAsync(firewallRuleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an IPv6 firewall rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// Operation Id: IPv6FirewallRules_Get + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetIPv6FirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) + { + return GetIPv6FirewallRules().Get(firewallRuleName, cancellationToken); + } + /// /// Gets a server. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index e9b1d1c3877e..f37846b3eacc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md @@ -4,7 +4,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4946dbb5b2893a77ce52d08e2a855056e1acd361/specification/sql/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/ea5f776735686bc6842f382f3d081000b4b680e8/specification/sql/resource-manager/readme.md namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated model-namespace: false