diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroup.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroup.cs new file mode 100644 index 000000000000..772cab673067 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroup.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A Class representing a DistributedAvailabilityGroup along with the instance operations that can be performed on it. + public partial class DistributedAvailabilityGroup : 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 DistributedAvailabilityGroup() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DistributedAvailabilityGroup(ArmClient armClient, DistributedAvailabilityGroupData data) : this(armClient, 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 DistributedAvailabilityGroup(ArmClient armClient, ResourceIdentifier id) : base(armClient, id) + { + _distributedAvailabilityGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, DiagnosticOptions); + ArmClient.TryGetApiVersion(ResourceType, out string distributedAvailabilityGroupApiVersion); + _distributedAvailabilityGroupRestClient = new DistributedAvailabilityGroupsRestOperations(_distributedAvailabilityGroupClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, 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)); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// OperationId: DistributedAvailabilityGroups_Get + /// Gets a distributed availability group info. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.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 await _distributedAvailabilityGroupClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new DistributedAvailabilityGroup(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// OperationId: DistributedAvailabilityGroups_Get + /// Gets a distributed availability group info. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.Get"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _distributedAvailabilityGroupClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroup(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// OperationId: DistributedAvailabilityGroups_Delete + /// Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.Delete"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DistributedAvailabilityGroupDeleteOperation(_distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// OperationId: DistributedAvailabilityGroups_Delete + /// Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual DistributedAvailabilityGroupDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.Delete"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DistributedAvailabilityGroupDeleteOperation(_distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// OperationId: DistributedAvailabilityGroups_Update + /// Updates a distributed availability group replication mode. + /// Waits for the completion of the long running operations. + /// The distributed availability group info. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.Update"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken).ConfigureAwait(false); + var operation = new DistributedAvailabilityGroupUpdateOperation(ArmClient, _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// OperationId: DistributedAvailabilityGroups_Update + /// Updates a distributed availability group replication mode. + /// Waits for the completion of the long running operations. + /// The distributed availability group info. + /// The cancellation token to use. + /// is null. + public virtual DistributedAvailabilityGroupUpdateOperation Update(bool waitForCompletion, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroup.Update"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken); + var operation = new DistributedAvailabilityGroupUpdateOperation(ArmClient, _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} 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..8230b639ce89 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs @@ -0,0 +1,373 @@ +// 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.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing collection of DistributedAvailabilityGroup and their operations over its parent. + 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 resource representing the parent resource. + internal DistributedAvailabilityGroupCollection(ArmResource parent) : base(parent) + { + _distributedAvailabilityGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", DistributedAvailabilityGroup.ResourceType.Namespace, DiagnosticOptions); + ArmClient.TryGetApiVersion(DistributedAvailabilityGroup.ResourceType, out string distributedAvailabilityGroupApiVersion); + _distributedAvailabilityGroupRestClient = new DistributedAvailabilityGroupsRestOperations(_distributedAvailabilityGroupClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, distributedAvailabilityGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstance.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstance.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: DistributedAvailabilityGroups_CreateOrUpdate + /// Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// is empty. + /// or is null. + public virtual DistributedAvailabilityGroupCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, parameters, cancellationToken); + var operation = new DistributedAvailabilityGroupCreateOrUpdateOperation(ArmClient, _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, parameters).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: DistributedAvailabilityGroups_CreateOrUpdate + /// Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// The distributed availability group name. + /// The distributed availability group info. + /// The cancellation token to use. + /// is empty. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, parameters, cancellationToken).ConfigureAwait(false); + var operation = new DistributedAvailabilityGroupCreateOrUpdateOperation(ArmClient, _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, parameters).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: DistributedAvailabilityGroups_Get + /// Gets a distributed availability group info. + /// The distributed availability group name. + /// The cancellation token to use. + /// is 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 _distributedAvailabilityGroupClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroup(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: DistributedAvailabilityGroups_Get + /// Gets a distributed availability group info. + /// The distributed availability group name. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual 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 await _distributedAvailabilityGroupClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new DistributedAvailabilityGroup(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The distributed availability group name. + /// The cancellation token to use. + /// is empty. + /// is null. + public virtual Response GetIfExists(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroup(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The distributed availability group name. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual Task> GetIfExistsAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroup(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The distributed availability group name. + /// The cancellation token to use. + /// is 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 = GetIfExists(distributedAvailabilityGroupName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The distributed availability group name. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual 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 GetIfExistsAsync(distributedAvailabilityGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: DistributedAvailabilityGroups_ListByInstance + /// Gets a list of a distributed availability groups in instance. + /// 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 DistributedAvailabilityGroup(ArmClient, 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 DistributedAvailabilityGroup(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: DistributedAvailabilityGroups_ListByInstance + /// Gets a list of a distributed availability groups in instance. + /// 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 DistributedAvailabilityGroup(ArmClient, 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 DistributedAvailabilityGroup(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + 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..8b8ff2077eb0 --- /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 : Resource + { + /// Initializes a new instance of DistributedAvailabilityGroupData. + public DistributedAvailabilityGroupData() + { + } + + /// Initializes a new instance of DistributedAvailabilityGroupData. + /// The id. + /// The name. + /// The type. + /// 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 type, 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, type, 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/ElasticPoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs index 6a6652238517..00acd1761599 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs @@ -280,7 +280,7 @@ public async virtual Task> ExistsAsync(string elasticPoolName, Ca /// 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) { @@ -322,7 +322,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// 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) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolData.cs index 63968e4bb2fd..811cbc1a898d 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 type, SystemData systemData, IDictionary tags, AzureLocation location, Models.Sku sku, string kind, ElasticPoolState? state, DateTimeOffset? creationDate, long? maxSizeBytes, ElasticPoolPerDatabaseSettings perDatabaseSettings, bool? zoneRedundant, ElasticPoolLicenseType? licenseType, string maintenanceConfigurationId) : base(id, name, type, 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 type, SystemData systemData, IDictionary tags, AzureLocation location, Models.Sku sku, string kind, ElasticPoolState? state, DateTimeOffset? creationDate, long? maxSizeBytes, ElasticPoolPerDatabaseSettings perDatabaseSettings, bool? zoneRedundant, ElasticPoolLicenseType? licenseType, string maintenanceConfigurationId, int? highAvailabilityReplicaCount) : base(id, name, type, systemData, tags, location) { Sku = sku; Kind = kind; @@ -58,6 +59,7 @@ internal ElasticPoolData(ResourceIdentifier id, string name, ResourceType type, ZoneRedundant = zoneRedundant; LicenseType = licenseType; MaintenanceConfigurationId = maintenanceConfigurationId; + HighAvailabilityReplicaCount = highAvailabilityReplicaCount; } /// @@ -87,5 +89,7 @@ internal ElasticPoolData(ResourceIdentifier id, string name, ResourceType type, 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/Extensions/ArmClientExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ArmClientExtensions.cs index 26890e09d069..88ea04cacfa3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ArmClientExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ArmClientExtensions.cs @@ -565,54 +565,6 @@ public static JobVersion GetJobVersion(this ArmClient armClient, ResourceIdentif } #endregion - #region SubscriptionLongTermRetentionBackup - /// Gets an object representing a SubscriptionLongTermRetentionBackup along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionLongTermRetentionBackup GetSubscriptionLongTermRetentionBackup(this ArmClient armClient, ResourceIdentifier id) - { - SubscriptionLongTermRetentionBackup.ValidateResourceId(id); - return new SubscriptionLongTermRetentionBackup(armClient, id); - } - #endregion - - #region ResourceGroupLongTermRetentionBackup - /// Gets an object representing a ResourceGroupLongTermRetentionBackup along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupLongTermRetentionBackup GetResourceGroupLongTermRetentionBackup(this ArmClient armClient, ResourceIdentifier id) - { - ResourceGroupLongTermRetentionBackup.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionBackup(armClient, id); - } - #endregion - - #region SubscriptionLongTermRetentionManagedInstanceBackup - /// Gets an object representing a SubscriptionLongTermRetentionManagedInstanceBackup along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionLongTermRetentionManagedInstanceBackup GetSubscriptionLongTermRetentionManagedInstanceBackup(this ArmClient armClient, ResourceIdentifier id) - { - SubscriptionLongTermRetentionManagedInstanceBackup.ValidateResourceId(id); - return new SubscriptionLongTermRetentionManagedInstanceBackup(armClient, id); - } - #endregion - - #region ResourceGroupLongTermRetentionManagedInstanceBackup - /// Gets an object representing a ResourceGroupLongTermRetentionManagedInstanceBackup along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupLongTermRetentionManagedInstanceBackup GetResourceGroupLongTermRetentionManagedInstanceBackup(this ArmClient armClient, ResourceIdentifier id) - { - ResourceGroupLongTermRetentionManagedInstanceBackup.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionManagedInstanceBackup(armClient, id); - } - #endregion - #region LongTermRetentionPolicy /// Gets an object representing a LongTermRetentionPolicy along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. @@ -841,18 +793,6 @@ public static ManagedInstancePrivateLink GetManagedInstancePrivateLink(this ArmC } #endregion - #region ManagedInstance - /// Gets an object representing a ManagedInstance along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedInstance GetManagedInstance(this ArmClient armClient, ResourceIdentifier id) - { - ManagedInstance.ValidateResourceId(id); - return new ManagedInstance(armClient, id); - } - #endregion - #region ManagedInstanceVulnerabilityAssessment /// Gets an object representing a ManagedInstanceVulnerabilityAssessment along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. @@ -1201,6 +1141,78 @@ public static OutboundFirewallRule GetOutboundFirewallRule(this ArmClient armCli } #endregion + #region SqlServer + /// Gets an object representing a SqlServer along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SqlServer GetSqlServer(this ArmClient armClient, ResourceIdentifier id) + { + SqlServer.ValidateResourceId(id); + return new SqlServer(armClient, id); + } + #endregion + + #region SubscriptionLongTermRetentionBackup + /// Gets an object representing a SubscriptionLongTermRetentionBackup along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionLongTermRetentionBackup GetSubscriptionLongTermRetentionBackup(this ArmClient armClient, ResourceIdentifier id) + { + SubscriptionLongTermRetentionBackup.ValidateResourceId(id); + return new SubscriptionLongTermRetentionBackup(armClient, id); + } + #endregion + + #region ResourceGroupLongTermRetentionBackup + /// Gets an object representing a ResourceGroupLongTermRetentionBackup along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGroupLongTermRetentionBackup GetResourceGroupLongTermRetentionBackup(this ArmClient armClient, ResourceIdentifier id) + { + ResourceGroupLongTermRetentionBackup.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionBackup(armClient, id); + } + #endregion + + #region SubscriptionLongTermRetentionManagedInstanceBackup + /// Gets an object representing a SubscriptionLongTermRetentionManagedInstanceBackup along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionLongTermRetentionManagedInstanceBackup GetSubscriptionLongTermRetentionManagedInstanceBackup(this ArmClient armClient, ResourceIdentifier id) + { + SubscriptionLongTermRetentionManagedInstanceBackup.ValidateResourceId(id); + return new SubscriptionLongTermRetentionManagedInstanceBackup(armClient, id); + } + #endregion + + #region ResourceGroupLongTermRetentionManagedInstanceBackup + /// Gets an object representing a ResourceGroupLongTermRetentionManagedInstanceBackup along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGroupLongTermRetentionManagedInstanceBackup GetResourceGroupLongTermRetentionManagedInstanceBackup(this ArmClient armClient, ResourceIdentifier id) + { + ResourceGroupLongTermRetentionManagedInstanceBackup.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionManagedInstanceBackup(armClient, id); + } + #endregion + + #region ManagedInstance + /// Gets an object representing a ManagedInstance along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedInstance GetManagedInstance(this ArmClient armClient, ResourceIdentifier id) + { + ManagedInstance.ValidateResourceId(id); + return new ManagedInstance(armClient, id); + } + #endregion + #region RestorableDroppedDatabase /// Gets an object representing a RestorableDroppedDatabase along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. @@ -1225,18 +1237,6 @@ public static RestorableDroppedManagedDatabase GetRestorableDroppedManagedDataba } #endregion - #region SqlServer - /// Gets an object representing a SqlServer along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SqlServer GetSqlServer(this ArmClient armClient, ResourceIdentifier id) - { - SqlServer.ValidateResourceId(id); - return new SqlServer(armClient, id); - } - #endregion - #region ServerConnectionPolicy /// Gets an object representing a ServerConnectionPolicy along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. @@ -1248,5 +1248,41 @@ public static ServerConnectionPolicy GetServerConnectionPolicy(this ArmClient ar return new ServerConnectionPolicy(armClient, id); } #endregion + + #region DistributedAvailabilityGroup + /// Gets an object representing a DistributedAvailabilityGroup along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DistributedAvailabilityGroup GetDistributedAvailabilityGroup(this ArmClient armClient, ResourceIdentifier id) + { + DistributedAvailabilityGroup.ValidateResourceId(id); + return new DistributedAvailabilityGroup(armClient, id); + } + #endregion + + #region ServerTrustCertificate + /// Gets an object representing a ServerTrustCertificate along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServerTrustCertificate GetServerTrustCertificate(this ArmClient armClient, ResourceIdentifier id) + { + ServerTrustCertificate.ValidateResourceId(id); + return new ServerTrustCertificate(armClient, id); + } + #endregion + + #region IPv6FirewallRule + /// Gets an object representing a IPv6FirewallRule along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static IPv6FirewallRule GetIPv6FirewallRule(this ArmClient armClient, ResourceIdentifier id) + { + IPv6FirewallRule.ValidateResourceId(id); + return new IPv6FirewallRule(armClient, id); + } + #endregion } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupExtensions.cs index 80c3d6c6a6f9..d35960a6a35d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupExtensions.cs @@ -36,6 +36,37 @@ public static InstancePoolCollection GetInstancePools(this ResourceGroup resourc } #endregion + #region ServerTrustGroup + /// Gets an object representing a ServerTrustGroupCollection along with the instance operations that can be performed on it. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// Returns a object. + public static ServerTrustGroupCollection GetServerTrustGroups(this ResourceGroup resourceGroup, string locationName) + { + return new ServerTrustGroupCollection(resourceGroup, locationName); + } + #endregion + + #region VirtualCluster + /// Gets an object representing a VirtualClusterCollection along with the instance operations that can be performed on it. + /// The instance the method will execute against. + /// Returns a object. + public static VirtualClusterCollection GetVirtualClusters(this ResourceGroup resourceGroup) + { + return new VirtualClusterCollection(resourceGroup); + } + #endregion + + #region SqlServer + /// Gets an object representing a SqlServerCollection along with the instance operations that can be performed on it. + /// The instance the method will execute against. + /// Returns a object. + public static SqlServerCollection GetSqlServers(this ResourceGroup resourceGroup) + { + return new SqlServerCollection(resourceGroup); + } + #endregion + #region ResourceGroupLongTermRetentionBackup /// Gets an object representing a ResourceGroupLongTermRetentionBackupCollection along with the instance operations that can be performed on it. /// The instance the method will execute against. @@ -72,37 +103,6 @@ public static ManagedInstanceCollection GetManagedInstances(this ResourceGroup r } #endregion - #region ServerTrustGroup - /// Gets an object representing a ServerTrustGroupCollection along with the instance operations that can be performed on it. - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// Returns a object. - public static ServerTrustGroupCollection GetServerTrustGroups(this ResourceGroup resourceGroup, string locationName) - { - return new ServerTrustGroupCollection(resourceGroup, locationName); - } - #endregion - - #region VirtualCluster - /// Gets an object representing a VirtualClusterCollection along with the instance operations that can be performed on it. - /// The instance the method will execute against. - /// Returns a object. - public static VirtualClusterCollection GetVirtualClusters(this ResourceGroup resourceGroup) - { - return new VirtualClusterCollection(resourceGroup); - } - #endregion - - #region SqlServer - /// Gets an object representing a SqlServerCollection along with the instance operations that can be performed on it. - /// The instance the method will execute against. - /// Returns a object. - public static SqlServerCollection GetSqlServers(this ResourceGroup resourceGroup) - { - return new SqlServerCollection(resourceGroup); - } - #endregion - private static ResourceGroupExtensionClient GetExtensionClient(ResourceGroup resourceGroup) { return resourceGroup.GetCachedClient((armClient) => diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensionClient.cs index a14e4a180265..6e8e85dcfea1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensionClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensionClient.cs @@ -28,20 +28,18 @@ internal partial class SubscriptionExtensionClient : 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 SubscriptionExtensionClient() @@ -61,20 +59,18 @@ internal SubscriptionExtensionClient(ArmClient armClient, ResourceIdentifier id) private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(InstancePoolClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, GetApiVersionOrNull(InstancePool.ResourceType)); private ClientDiagnostics CapabilitiesClientDiagnostics => _capabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); private CapabilitiesRestOperations CapabilitiesRestClient => _capabilitiesRestClient ??= new CapabilitiesRestOperations(CapabilitiesClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); - private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); - private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(LongTermRetentionBackupsClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); - private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); - private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); - private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstance.ResourceType.Namespace, DiagnosticOptions); - private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(ManagedInstanceClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, GetApiVersionOrNull(ManagedInstance.ResourceType)); - private ClientDiagnostics OperationsHealthClientDiagnostics => _operationsHealthClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); - private OperationsHealthRestOperations OperationsHealthRestClient => _operationsHealthRestClient ??= new OperationsHealthRestOperations(OperationsHealthClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); private ClientDiagnostics SyncGroupClientDiagnostics => _syncGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SyncGroup.ResourceType.Namespace, DiagnosticOptions); private SyncGroupsRestOperations SyncGroupRestClient => _syncGroupRestClient ??= new SyncGroupsRestOperations(SyncGroupClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, GetApiVersionOrNull(SyncGroup.ResourceType)); private ClientDiagnostics VirtualClusterClientDiagnostics => _virtualClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", VirtualCluster.ResourceType.Namespace, DiagnosticOptions); private VirtualClustersRestOperations VirtualClusterRestClient => _virtualClusterRestClient ??= new VirtualClustersRestOperations(VirtualClusterClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, GetApiVersionOrNull(VirtualCluster.ResourceType)); private ClientDiagnostics SqlServerServersClientDiagnostics => _sqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServer.ResourceType.Namespace, DiagnosticOptions); private ServersRestOperations SqlServerServersRestClient => _sqlServerServersRestClient ??= new ServersRestOperations(SqlServerServersClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, GetApiVersionOrNull(SqlServer.ResourceType)); + private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); + private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(LongTermRetentionBackupsClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); + private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); + private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); + private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstance.ResourceType.Namespace, DiagnosticOptions); + private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(ManagedInstanceClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, GetApiVersionOrNull(ManagedInstance.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -300,28 +296,26 @@ public virtual Response GetByLocationCapability(string loc } } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionBackups_ListByLocation - /// Lists the long term retention backups for a given location. - /// 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. + /// OperationId: SyncGroups_ListSyncDatabaseIds + /// Gets a collection of sync database ids. + /// The name of the region where the resource is located. /// The cancellation token to use. /// is empty. /// is null. - /// 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) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + 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) @@ -330,13 +324,13 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + 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) @@ -348,28 +342,26 @@ async Task> NextPageFunc(string nextLink, int? return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionBackups_ListByLocation - /// Lists the long term retention backups for a given location. - /// 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. + /// OperationId: SyncGroups_ListSyncDatabaseIds + /// Gets a collection of sync database ids. + /// The name of the region where the resource is located. /// The cancellation token to use. /// is empty. /// is null. - /// 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) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + var response = SyncGroupRestClient.ListSyncDatabaseIds(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -378,13 +370,13 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + var response = SyncGroupRestClient.ListSyncDatabaseIdsNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -396,31 +388,22 @@ Page NextPageFunc(string nextLink, int? pageSizeHin return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionBackups_ListByServer - /// Lists the long term retention backups for a given server. - /// 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. + /// OperationId: VirtualClusters_List + /// Gets a list of all virtualClusters in the subscription. /// The cancellation token to use. - /// or is empty. - /// or is null. - /// 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) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionExtensionClient.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, 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 VirtualCluster(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -428,14 +411,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionExtensionClient.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, 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 VirtualCluster(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -446,31 +429,22 @@ async Task> NextPageFunc(string nextLink, int? return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionBackups_ListByServer - /// Lists the long term retention backups for a given server. - /// 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. + /// OperationId: VirtualClusters_List + /// Gets a list of all virtualClusters in the subscription. /// The cancellation token to use. - /// or is empty. - /// or is null. - /// 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) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = VirtualClusterRestClient.List(Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualCluster(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -478,14 +452,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = VirtualClusterRestClient.ListNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualCluster(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -496,31 +470,23 @@ Page NextPageFunc(string nextLink, int? pageSizeHin return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionManagedInstanceBackups_ListByInstance - /// Lists the long term retention backups for a given managed instance. - /// 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. + /// OperationId: Servers_List + /// Gets a list of all servers in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is empty. - /// or is null. - /// 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) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.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, 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 SqlServer(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -528,14 +494,14 @@ async Task> FirstPageFunc(int? throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.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, 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 SqlServer(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -546,31 +512,23 @@ async Task> NextPageFunc(string return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionManagedInstanceBackups_ListByInstance - /// Lists the long term retention backups for a given managed instance. - /// 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. + /// OperationId: Servers_List + /// Gets a list of all servers in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is empty. - /// or is null. - /// 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) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSqlServers"); scope.Start(); try { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = SqlServerServersRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SqlServer(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -578,14 +536,14 @@ Page FirstPageFunc(int? pageSizeHint throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSqlServers"); scope.Start(); try { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.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 SqlServer(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -596,119 +554,85 @@ Page NextPageFunc(string nextLink, i return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionManagedInstanceBackups_ListByLocation - /// Lists the long term retention backups for managed databases in a given location. - /// 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. + /// OperationId: Servers_CheckNameAvailability + /// Determines whether a resource can be created with the specified name. + /// The name availability request parameters. /// The cancellation token to use. - /// is empty. - /// is null. - /// 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) + /// is null. + public async virtual Task> CheckNameAvailabilityServerAsync(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - async Task> FirstPageFunc(int? pageSizeHint) + if (parameters == null) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + throw new ArgumentNullException(nameof(parameters)); } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.CheckNameAvailabilityServer"); + scope.Start(); + try { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.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, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, parameters, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: LongTermRetentionManagedInstanceBackups_ListByLocation - /// Lists the long term retention backups for managed databases in a given location. - /// 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. + /// OperationId: Servers_CheckNameAvailability + /// Determines whether a resource can be created with the specified name. + /// The name availability request parameters. /// The cancellation token to use. - /// is empty. - /// is null. - /// 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) + /// is null. + public virtual Response CheckNameAvailabilityServer(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - Page FirstPageFunc(int? pageSizeHint) + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.CheckNameAvailabilityServer"); + scope.Start(); + try { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = SqlServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, parameters, cancellationToken); + return response; } - Page NextPageFunc(string nextLink, int? pageSizeHint) + catch (Exception e) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, 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); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: ManagedInstances_List - /// Gets a list of all managed instances in the subscription. - /// The child resources to include in the response. + /// OperationId: LongTermRetentionBackups_ListByLocation + /// Lists the long term retention backups for a given location. + /// 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) + /// is empty. + /// is null. + /// 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) + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.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 ManagedInstance(ArmClient, 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, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -716,14 +640,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("SubscriptionExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.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 ManagedInstance(ArmClient, 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, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -734,23 +658,29 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: ManagedInstances_List - /// Gets a list of all managed instances in the subscription. - /// The child resources to include in the response. + /// OperationId: LongTermRetentionBackups_ListByLocation + /// Lists the long term retention backups for a given location. + /// 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) + /// is empty. + /// is null. + /// 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) + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + Page FirstPageFunc(int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = ManagedInstanceRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstance(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -758,14 +688,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = ManagedInstanceRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstance(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -776,26 +706,30 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: OperationsHealth_ListByLocation - /// Gets a service operation health status. - /// The name of the region where the resource is located. + /// OperationId: LongTermRetentionBackups_ListByServer + /// Lists the long term retention backups for a given server. + /// 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. - /// is empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsHealthsByLocationAsync(string locationName, CancellationToken cancellationToken = default) + /// or is empty. + /// or is null. + /// 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) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = await OperationsHealthRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await LongTermRetentionBackupsRestClient.ListByServerAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -804,13 +738,13 @@ 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("SubscriptionExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = await OperationsHealthRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await LongTermRetentionBackupsRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -822,26 +756,30 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: OperationsHealth_ListByLocation - /// Gets a service operation health status. - /// The name of the region where the resource is located. + /// OperationId: LongTermRetentionBackups_ListByServer + /// Lists the long term retention backups for a given server. + /// 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. - /// is empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationsHealthsByLocation(string locationName, CancellationToken cancellationToken = default) + /// or is empty. + /// or is null. + /// 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) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = OperationsHealthRestClient.ListByLocation(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -850,13 +788,13 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = OperationsHealthRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -868,26 +806,30 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: SyncGroups_ListSyncDatabaseIds - /// Gets a collection of sync database ids. - /// The name of the region where the resource is located. + /// OperationId: LongTermRetentionManagedInstanceBackups_ListByInstance + /// Lists the long term retention backups for a given managed instance. + /// 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. - /// is empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(string locationName, CancellationToken cancellationToken = default) + /// or is empty. + /// or is null. + /// 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) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = await SyncGroupRestClient.ListSyncDatabaseIdsAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceAsync(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -896,13 +838,13 @@ 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("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = await SyncGroupRestClient.ListSyncDatabaseIdsNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -914,26 +856,30 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: SyncGroups_ListSyncDatabaseIds - /// Gets a collection of sync database ids. - /// The name of the region where the resource is located. + /// OperationId: LongTermRetentionManagedInstanceBackups_ListByInstance + /// Lists the long term retention backups for a given managed instance. + /// 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. - /// is empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSyncDatabaseIdsSyncGroups(string locationName, CancellationToken cancellationToken = default) + /// or is empty. + /// or is null. + /// 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) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = SyncGroupRestClient.ListSyncDatabaseIds(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -942,13 +888,13 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = SyncGroupRestClient.ListSyncDatabaseIdsNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -960,22 +906,29 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: VirtualClusters_List - /// Gets a list of all virtualClusters in the subscription. + /// OperationId: LongTermRetentionManagedInstanceBackups_ListByLocation + /// Lists the long term retention backups for managed databases in a given location. + /// 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) + /// is empty. + /// is null. + /// 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) + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = await VirtualClusterRestClient.ListAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new VirtualCluster(ArmClient, 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, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -983,14 +936,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("SubscriptionExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.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 VirtualCluster(ArmClient, 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, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1001,22 +954,29 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: VirtualClusters_List - /// Gets a list of all virtualClusters in the subscription. + /// OperationId: LongTermRetentionManagedInstanceBackups_ListByLocation + /// Lists the long term retention backups for managed databases in a given location. + /// 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) + /// is empty. + /// is null. + /// 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) + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + Page FirstPageFunc(int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = VirtualClusterRestClient.List(Id.SubscriptionId, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new VirtualCluster(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1024,14 +984,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = VirtualClusterRestClient.ListNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new VirtualCluster(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1042,23 +1002,23 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: Servers_List - /// Gets a list of all servers in the subscription. + /// OperationId: ManagedInstances_List + /// Gets a list of all managed instances in the subscription. /// 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("SubscriptionExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionExtensionClient.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 SqlServer(ArmClient, 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 ManagedInstance(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1066,14 +1026,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("SubscriptionExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionExtensionClient.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 SqlServer(ArmClient, 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 ManagedInstance(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1084,23 +1044,23 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: Servers_List - /// Gets a list of all servers in the subscription. + /// OperationId: ManagedInstances_List + /// Gets a list of all managed instances in the subscription. /// 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("SubscriptionExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = SqlServerServersRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SqlServer(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + var response = ManagedInstanceRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstance(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1108,14 +1068,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = SqlServerServersRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SqlServer(ArmClient, 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 ManagedInstance(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1125,61 +1085,5 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: Servers_CheckNameAvailability - /// Determines whether a resource can be created with the specified name. - /// The name availability request parameters. - /// The cancellation token to use. - /// is null. - public async virtual Task> CheckNameAvailabilityServerAsync(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.CheckNameAvailabilityServer"); - scope.Start(); - try - { - var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, parameters, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: Servers_CheckNameAvailability - /// Determines whether a resource can be created with the specified name. - /// The name availability request parameters. - /// The cancellation token to use. - /// is null. - public virtual Response CheckNameAvailabilityServer(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionExtensionClient.CheckNameAvailabilityServer"); - scope.Start(); - try - { - var response = SqlServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, parameters, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensions.cs index eacfc7f0c9c4..7f24b30542f1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionExtensions.cs @@ -28,6 +28,28 @@ public static DeletedServerCollection GetDeletedServers(this Subscription subscr } #endregion + #region SubscriptionUsage + /// Gets an object representing a SubscriptionUsageCollection along with the instance operations that can be performed on it. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// Returns a object. + public static SubscriptionUsageCollection GetSubscriptionUsages(this Subscription subscription, string locationName) + { + return new SubscriptionUsageCollection(subscription, locationName); + } + #endregion + + #region SqlTimeZone + /// Gets an object representing a SqlTimeZoneCollection along with the instance operations that can be performed on it. + /// The instance the method will execute against. + /// The String to use. + /// Returns a object. + public static SqlTimeZoneCollection GetSqlTimeZones(this Subscription subscription, string locationName) + { + return new SqlTimeZoneCollection(subscription, locationName); + } + #endregion + #region SubscriptionLongTermRetentionBackup /// Gets an object representing a SubscriptionLongTermRetentionBackupCollection along with the instance operations that can be performed on it. /// The instance the method will execute against. @@ -54,28 +76,6 @@ public static SubscriptionLongTermRetentionManagedInstanceBackupCollection GetSu } #endregion - #region SubscriptionUsage - /// Gets an object representing a SubscriptionUsageCollection along with the instance operations that can be performed on it. - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// Returns a object. - public static SubscriptionUsageCollection GetSubscriptionUsages(this Subscription subscription, string locationName) - { - return new SubscriptionUsageCollection(subscription, locationName); - } - #endregion - - #region SqlTimeZone - /// Gets an object representing a SqlTimeZoneCollection along with the instance operations that can be performed on it. - /// The instance the method will execute against. - /// The String to use. - /// Returns a object. - public static SqlTimeZoneCollection GetSqlTimeZones(this Subscription subscription, string locationName) - { - return new SqlTimeZoneCollection(subscription, locationName); - } - #endregion - private static SubscriptionExtensionClient GetExtensionClient(Subscription subscription) { return subscription.GetCachedClient((armClient) => @@ -157,6 +157,104 @@ public static Response GetByLocationCapability(this Subscr return GetExtensionClient(subscription).GetByLocationCapability(locationName, include, cancellationToken); } + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: SyncGroups_ListSyncDatabaseIds + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is empty. + /// is null. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this Subscription subscription, string locationName, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscription).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: SyncGroups_ListSyncDatabaseIds + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is empty. + /// is null. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static Pageable GetSyncDatabaseIdsSyncGroups(this Subscription subscription, string locationName, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscription).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: VirtualClusters_List + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static AsyncPageable GetVirtualClustersAsync(this Subscription subscription, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscription).GetVirtualClustersAsync(cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: VirtualClusters_List + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static Pageable GetVirtualClusters(this Subscription subscription, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscription).GetVirtualClusters(cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: 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 resource operations that may take multiple service requests to iterate over. + public static AsyncPageable GetSqlServersAsync(this Subscription subscription, string expand = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscription).GetSqlServersAsync(expand, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: 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 resource operations that may take multiple service requests to iterate over. + public static Pageable GetSqlServers(this Subscription subscription, string expand = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscription).GetSqlServers(expand, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: 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 Subscription subscription, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) + { + return await GetExtensionClient(subscription).CheckNameAvailabilityServerAsync(parameters, cancellationToken).ConfigureAwait(false); + } + + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// ContextualPath: /subscriptions/{subscriptionId} + /// OperationId: 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 Subscription subscription, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscription).CheckNameAvailabilityServer(parameters, cancellationToken); + } + /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups /// ContextualPath: /subscriptions/{subscriptionId} /// OperationId: LongTermRetentionBackups_ListByLocation @@ -312,131 +410,5 @@ public static Pageable GetManagedInstances(this Subscription su { return GetExtensionClient(subscription).GetManagedInstances(expand, cancellationToken); } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: 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 empty. - /// is null. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable GetOperationsHealthsByLocationAsync(this Subscription subscription, string locationName, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetOperationsHealthsByLocationAsync(locationName, cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: 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 empty. - /// is null. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable GetOperationsHealthsByLocation(this Subscription subscription, string locationName, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetOperationsHealthsByLocation(locationName, cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: SyncGroups_ListSyncDatabaseIds - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// is empty. - /// is null. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this Subscription subscription, string locationName, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: SyncGroups_ListSyncDatabaseIds - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// is empty. - /// is null. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable GetSyncDatabaseIdsSyncGroups(this Subscription subscription, string locationName, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: VirtualClusters_List - /// The instance the method will execute against. - /// The cancellation token to use. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable GetVirtualClustersAsync(this Subscription subscription, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetVirtualClustersAsync(cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: VirtualClusters_List - /// The instance the method will execute against. - /// The cancellation token to use. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable GetVirtualClusters(this Subscription subscription, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetVirtualClusters(cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: 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 resource operations that may take multiple service requests to iterate over. - public static AsyncPageable GetSqlServersAsync(this Subscription subscription, string expand = null, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetSqlServersAsync(expand, cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: 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 resource operations that may take multiple service requests to iterate over. - public static Pageable GetSqlServers(this Subscription subscription, string expand = null, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).GetSqlServers(expand, cancellationToken); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: 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 Subscription subscription, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) - { - return await GetExtensionClient(subscription).CheckNameAvailabilityServerAsync(parameters, cancellationToken).ConfigureAwait(false); - } - - /// RequestPath: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// ContextualPath: /subscriptions/{subscriptionId} - /// OperationId: 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 Subscription subscription, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) - { - return GetExtensionClient(subscription).CheckNameAvailabilityServer(parameters, cancellationToken); - } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRule.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRule.cs new file mode 100644 index 000000000000..457363f5affd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRule.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A Class representing a IPv6FirewallRule along with the instance operations that can be performed on it. + public partial class IPv6FirewallRule : 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 IPv6FirewallRule() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal IPv6FirewallRule(ArmClient armClient, IPv6FirewallRuleData data) : this(armClient, 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 IPv6FirewallRule(ArmClient armClient, ResourceIdentifier id) : base(armClient, id) + { + _iPv6FirewallRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, DiagnosticOptions); + ArmClient.TryGetApiVersion(ResourceType, out string iPv6FirewallRuleApiVersion); + _iPv6FirewallRuleRestClient = new IPv6FirewallRulesRestOperations(_iPv6FirewallRuleClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, 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)); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// OperationId: IPv6FirewallRules_Get + /// Gets an IPv6 firewall rule. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRule.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 await _iPv6FirewallRuleClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new IPv6FirewallRule(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// OperationId: IPv6FirewallRules_Get + /// Gets an IPv6 firewall rule. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRule.Get"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _iPv6FirewallRuleClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRule(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRule.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRule.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// OperationId: IPv6FirewallRules_Delete + /// Deletes an IPv6 firewall rule. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRule.Delete"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IPv6FirewallRuleDeleteOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// OperationId: IPv6FirewallRules_Delete + /// Deletes an IPv6 firewall rule. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual IPv6FirewallRuleDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRule.Delete"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IPv6FirewallRuleDeleteOperation(response); + if (waitForCompletion) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + 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..31702779df00 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs @@ -0,0 +1,373 @@ +// 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.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing collection of IPv6FirewallRule and their operations over its parent. + 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 resource representing the parent resource. + internal IPv6FirewallRuleCollection(ArmResource parent) : base(parent) + { + _iPv6FirewallRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", IPv6FirewallRule.ResourceType.Namespace, DiagnosticOptions); + ArmClient.TryGetApiVersion(IPv6FirewallRule.ResourceType, out string iPv6FirewallRuleApiVersion); + _iPv6FirewallRuleRestClient = new IPv6FirewallRulesRestOperations(_iPv6FirewallRuleClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, iPv6FirewallRuleApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SqlServer.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SqlServer.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// OperationId: IPv6FirewallRules_CreateOrUpdate + /// Creates or updates an IPv6 firewall rule. + /// Waits for the completion of the long running operations. + /// The name of the firewall rule. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// is empty. + /// or is null. + public virtual IPv6FirewallRuleCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string firewallRuleName, IPv6FirewallRuleData parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, parameters, cancellationToken); + var operation = new IPv6FirewallRuleCreateOrUpdateOperation(ArmClient, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// OperationId: IPv6FirewallRules_CreateOrUpdate + /// Creates or updates an IPv6 firewall rule. + /// Waits for the completion of the long running operations. + /// The name of the firewall rule. + /// The required parameters for creating or updating an IPv6 firewall rule. + /// The cancellation token to use. + /// is empty. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string firewallRuleName, IPv6FirewallRuleData parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, parameters, cancellationToken).ConfigureAwait(false); + var operation = new IPv6FirewallRuleCreateOrUpdateOperation(ArmClient, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// OperationId: IPv6FirewallRules_Get + /// Gets an IPv6 firewall rule. + /// The name of the firewall rule. + /// The cancellation token to use. + /// is 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 _iPv6FirewallRuleClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRule(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// OperationId: IPv6FirewallRules_Get + /// Gets an IPv6 firewall rule. + /// The name of the firewall rule. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual 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 await _iPv6FirewallRuleClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new IPv6FirewallRule(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The name of the firewall rule. + /// The cancellation token to use. + /// is empty. + /// is null. + public virtual Response GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRule(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The name of the firewall rule. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRule(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The name of the firewall rule. + /// The cancellation token to use. + /// is 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 = GetIfExists(firewallRuleName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The name of the firewall rule. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual 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 GetIfExistsAsync(firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// OperationId: IPv6FirewallRules_ListByServer + /// Gets a list of IPv6 firewall rules. + /// 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 IPv6FirewallRule(ArmClient, 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 IPv6FirewallRule(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// OperationId: IPv6FirewallRules_ListByServer + /// Gets a list of IPv6 firewall rules. + /// 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 IPv6FirewallRule(ArmClient, 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 IPv6FirewallRule(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + 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..cd4553c81daf --- /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 type, string startIPv6Address, string endIPv6Address) : base(id, name, type) + { + 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/InstancePool.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePool.cs index 5feb52a50fef..de59b55229b0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePool.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePool.cs @@ -31,10 +31,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. @@ -59,11 +59,11 @@ internal InstancePool(ArmClient armClient, ResourceIdentifier id) : base(armClie _instancePoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, DiagnosticOptions); ArmClient.TryGetApiVersion(ResourceType, out string instancePoolApiVersion); _instancePoolRestClient = new InstancePoolsRestOperations(_instancePoolClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, instancePoolApiVersion); + _usagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); + _usagesRestClient = new UsagesRestOperations(_usagesClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); _managedInstanceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstance.ResourceType.Namespace, DiagnosticOptions); ArmClient.TryGetApiVersion(ManagedInstance.ResourceType, out string managedInstanceApiVersion); _managedInstanceRestClient = new ManagedInstancesRestOperations(_managedInstanceClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, managedInstanceApiVersion); - _usagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, DiagnosticOptions); - _usagesRestClient = new UsagesRestOperations(_usagesClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri); #if DEBUG ValidateResourceId(Id); #endif @@ -449,22 +449,22 @@ public virtual InstancePoolUpdateOperation Update(bool waitForCompletion, Instan } } - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// OperationId: ManagedInstances_ListByInstancePool - /// Gets a list of all managed instances in an instance pool. - /// The child resources to include in the response. + /// OperationId: Usages_ListByInstancePool + /// Gets all instance pool usage metrics. + /// 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("InstancePool.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePool.GetUsages"); scope.Start(); try { - var response = await _managedInstanceRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + 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) @@ -473,13 +473,13 @@ 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("InstancePool.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePool.GetUsages"); scope.Start(); try { - var response = await _managedInstanceRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + 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) @@ -491,22 +491,22 @@ async Task> NextPageFunc(string nextLink, int? pageSiz return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// OperationId: ManagedInstances_ListByInstancePool - /// Gets a list of all managed instances in an instance pool. - /// The child resources to include in the response. + /// OperationId: Usages_ListByInstancePool + /// Gets all instance pool usage metrics. + /// 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("InstancePool.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePool.GetUsages"); scope.Start(); try { - var response = _managedInstanceRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); + 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) @@ -515,13 +515,13 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePool.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePool.GetUsages"); scope.Start(); try { - var response = _managedInstanceRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); + 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) @@ -533,22 +533,22 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// OperationId: Usages_ListByInstancePool - /// Gets all instance pool usage metrics. - /// Optional request parameter to include managed instance usages within the instance pool. + /// OperationId: ManagedInstances_ListByInstancePool + /// Gets a list of all managed instances in an 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("InstancePool.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePool.GetManagedInstances"); scope.Start(); try { - var response = await _usagesRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _managedInstanceRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -557,13 +557,13 @@ 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("InstancePool.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePool.GetManagedInstances"); scope.Start(); try { - var response = await _usagesRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _managedInstanceRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -575,22 +575,22 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// OperationId: Usages_ListByInstancePool - /// Gets all instance pool usage metrics. - /// Optional request parameter to include managed instance usages within the instance pool. + /// OperationId: ManagedInstances_ListByInstancePool + /// Gets a list of all managed instances in an 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("InstancePool.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePool.GetManagedInstances"); scope.Start(); try { - var response = _usagesRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); + var response = _managedInstanceRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -599,13 +599,13 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePool.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePool.GetManagedInstances"); scope.Start(); try { - var response = _usagesRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); + var response = _managedInstanceRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..812e1a4dd0b3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupCreateOrUpdateOperation.cs @@ -0,0 +1,79 @@ +// 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; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. + public partial class DistributedAvailabilityGroupCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmClient _armClient; + + /// Initializes a new instance of DistributedAvailabilityGroupCreateOrUpdateOperation for mocking. + protected DistributedAvailabilityGroupCreateOrUpdateOperation() + { + } + + internal DistributedAvailabilityGroupCreateOrUpdateOperation(ArmClient armClient, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DistributedAvailabilityGroupCreateOrUpdateOperation"); + _armClient = armClient; + } + + /// + public override string Id => _operation.Id; + + /// + public override DistributedAvailabilityGroup Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + DistributedAvailabilityGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DistributedAvailabilityGroupData.DeserializeDistributedAvailabilityGroupData(document.RootElement); + return new DistributedAvailabilityGroup(_armClient, 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 DistributedAvailabilityGroup(_armClient, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupDeleteOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupDeleteOperation.cs new file mode 100644 index 000000000000..d7bb30f825a6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + public partial class DistributedAvailabilityGroupDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of DistributedAvailabilityGroupDeleteOperation for mocking. + protected DistributedAvailabilityGroupDeleteOperation() + { + } + + internal DistributedAvailabilityGroupDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DistributedAvailabilityGroupDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupUpdateOperation.cs new file mode 100644 index 000000000000..dcbbcd937185 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/DistributedAvailabilityGroupUpdateOperation.cs @@ -0,0 +1,79 @@ +// 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; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Updates a distributed availability group replication mode. + public partial class DistributedAvailabilityGroupUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmClient _armClient; + + /// Initializes a new instance of DistributedAvailabilityGroupUpdateOperation for mocking. + protected DistributedAvailabilityGroupUpdateOperation() + { + } + + internal DistributedAvailabilityGroupUpdateOperation(ArmClient armClient, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DistributedAvailabilityGroupUpdateOperation"); + _armClient = armClient; + } + + /// + public override string Id => _operation.Id; + + /// + public override DistributedAvailabilityGroup Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + DistributedAvailabilityGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DistributedAvailabilityGroupData.DeserializeDistributedAvailabilityGroupData(document.RootElement); + return new DistributedAvailabilityGroup(_armClient, 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 DistributedAvailabilityGroup(_armClient, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/IPv6FirewallRuleCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/IPv6FirewallRuleCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..392a741b3e9a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/IPv6FirewallRuleCreateOrUpdateOperation.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Creates or updates an IPv6 firewall rule. + public partial class IPv6FirewallRuleCreateOrUpdateOperation : Operation + { + private readonly OperationOrResponseInternals _operation; + + /// Initializes a new instance of IPv6FirewallRuleCreateOrUpdateOperation for mocking. + protected IPv6FirewallRuleCreateOrUpdateOperation() + { + } + + internal IPv6FirewallRuleCreateOrUpdateOperation(ArmClient armClient, Response response) + { + _operation = new OperationOrResponseInternals(Response.FromValue(new IPv6FirewallRule(armClient, response.Value), response.GetRawResponse())); + } + + /// + public override string Id => _operation.Id; + + /// + public override IPv6FirewallRule Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/IPv6FirewallRuleDeleteOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/IPv6FirewallRuleDeleteOperation.cs new file mode 100644 index 000000000000..75934b8bd114 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/IPv6FirewallRuleDeleteOperation.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Deletes an IPv6 firewall rule. + public partial class IPv6FirewallRuleDeleteOperation : Operation + { + private readonly OperationOrResponseInternals _operation; + + /// Initializes a new instance of IPv6FirewallRuleDeleteOperation for mocking. + protected IPv6FirewallRuleDeleteOperation() + { + } + + internal IPv6FirewallRuleDeleteOperation(Response response) + { + _operation = new OperationOrResponseInternals(response); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..7463cc4b5862 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateCreateOrUpdateOperation.cs @@ -0,0 +1,79 @@ +// 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; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Uploads a server trust certificate from box to Sql Managed Instance. + public partial class ServerTrustCertificateCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmClient _armClient; + + /// Initializes a new instance of ServerTrustCertificateCreateOrUpdateOperation for mocking. + protected ServerTrustCertificateCreateOrUpdateOperation() + { + } + + internal ServerTrustCertificateCreateOrUpdateOperation(ArmClient armClient, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServerTrustCertificateCreateOrUpdateOperation"); + _armClient = armClient; + } + + /// + public override string Id => _operation.Id; + + /// + public override ServerTrustCertificate Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ServerTrustCertificate IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ServerTrustCertificateData.DeserializeServerTrustCertificateData(document.RootElement); + return new ServerTrustCertificate(_armClient, 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 ServerTrustCertificate(_armClient, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateDeleteOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateDeleteOperation.cs new file mode 100644 index 000000000000..56a247ea4257 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ServerTrustCertificateDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + public partial class ServerTrustCertificateDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of ServerTrustCertificateDeleteOperation for mocking. + protected ServerTrustCertificateDeleteOperation() + { + } + + internal ServerTrustCertificateDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServerTrustCertificateDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstance.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstance.cs index 664d24357dcc..43231e19cdb4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstance.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstance.cs @@ -538,6 +538,152 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ManagedInstanceTdeCertificates_Create + /// Creates a TDE certificate for a given server. + /// Waits for the completion of the long running operations. + /// The requested TDE certificate to be created or updated. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateManagedInstanceTdeCertificateAsync(bool waitForCompletion, TdeCertificate parameters, CancellationToken cancellationToken = default) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstance.CreateManagedInstanceTdeCertificate"); + scope.Start(); + try + { + var response = await _managedInstanceTdeCertificatesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken).ConfigureAwait(false); + var operation = new ManagedInstanceCreateManagedInstanceTdeCertificateOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ManagedInstanceTdeCertificates_Create + /// Creates a TDE certificate for a given server. + /// Waits for the completion of the long running operations. + /// The requested TDE certificate to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual ManagedInstanceCreateManagedInstanceTdeCertificateOperation CreateManagedInstanceTdeCertificate(bool waitForCompletion, TdeCertificate parameters, CancellationToken cancellationToken = default) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstance.CreateManagedInstanceTdeCertificate"); + scope.Start(); + try + { + var response = _managedInstanceTdeCertificatesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken); + var operation = new ManagedInstanceCreateManagedInstanceTdeCertificateOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response); + if (waitForCompletion) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustGroups_ListByInstance + /// Gets a server trust groups by instance name. + /// 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("ManagedInstance.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, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstance.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, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustGroups_ListByInstance + /// Gets a server trust groups by instance name. + /// 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("ManagedInstance.GetServerTrustGroups"); + scope.Start(); + try + { + var response = _serverTrustGroupRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstance.GetServerTrustGroups"); + scope.Start(); + try + { + var response = _serverTrustGroupRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, 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); + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} /// OperationId: ManagedInstances_ListByManagedInstance @@ -686,152 +832,6 @@ public virtual ManagedInstanceFailoverOperation Failover(bool waitForCompletion, } } - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} - /// OperationId: ManagedInstanceTdeCertificates_Create - /// Creates a TDE certificate for a given server. - /// Waits for the completion of the long running operations. - /// The requested TDE certificate to be created or updated. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateManagedInstanceTdeCertificateAsync(bool waitForCompletion, TdeCertificate parameters, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstance.CreateManagedInstanceTdeCertificate"); - scope.Start(); - try - { - var response = await _managedInstanceTdeCertificatesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken).ConfigureAwait(false); - var operation = new ManagedInstanceCreateManagedInstanceTdeCertificateOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} - /// OperationId: ManagedInstanceTdeCertificates_Create - /// Creates a TDE certificate for a given server. - /// Waits for the completion of the long running operations. - /// The requested TDE certificate to be created or updated. - /// The cancellation token to use. - /// is null. - public virtual ManagedInstanceCreateManagedInstanceTdeCertificateOperation CreateManagedInstanceTdeCertificate(bool waitForCompletion, TdeCertificate parameters, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstance.CreateManagedInstanceTdeCertificate"); - scope.Start(); - try - { - var response = _managedInstanceTdeCertificatesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken); - var operation = new ManagedInstanceCreateManagedInstanceTdeCertificateOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response); - if (waitForCompletion) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} - /// OperationId: ServerTrustGroups_ListByInstance - /// Gets a server trust groups by instance name. - /// 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("ManagedInstance.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, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstance.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, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} - /// OperationId: ServerTrustGroups_ListByInstance - /// Gets a server trust groups by instance name. - /// 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("ManagedInstance.GetServerTrustGroups"); - scope.Start(); - try - { - var response = _serverTrustGroupRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstance.GetServerTrustGroups"); - scope.Start(); - try - { - var response = _serverTrustGroupRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, 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); - } - #region ManagedDatabase /// Gets a collection of ManagedDatabases in the ManagedInstance. @@ -961,5 +961,25 @@ public virtual RestorableDroppedManagedDatabaseCollection GetRestorableDroppedMa return new RestorableDroppedManagedDatabaseCollection(this); } #endregion + + #region DistributedAvailabilityGroup + + /// Gets a collection of DistributedAvailabilityGroups in the ManagedInstance. + /// An object representing collection of DistributedAvailabilityGroups and their operations over a ManagedInstance. + public virtual DistributedAvailabilityGroupCollection GetDistributedAvailabilityGroups() + { + return new DistributedAvailabilityGroupCollection(this); + } + #endregion + + #region ServerTrustCertificate + + /// Gets a collection of ServerTrustCertificates in the ManagedInstance. + /// An object representing collection of ServerTrustCertificates and their operations over a ManagedInstance. + public virtual ServerTrustCertificateCollection GetServerTrustCertificates() + { + return new ServerTrustCertificateCollection(this); + } + #endregion } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs index 256a49ace536..2ff2cf1a10d5 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 type, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, Models.Sku 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? restorePointInTime, 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, type, systemData, tags, location) + /// The managed instance's service principal. + internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, Models.Sku 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? restorePointInTime, 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, type, systemData, tags, location) { Identity = identity; Sku = sku; @@ -98,11 +100,13 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType ty 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 ty 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 ty 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/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..33eb1d3253eb --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs @@ -0,0 +1,113 @@ +// 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(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.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(); + } + if (Optional.IsCollectionDefined(DelegatedResources)) + { + writer.WritePropertyName("delegatedResources"); + writer.WriteStartObject(); + foreach (var item in DelegatedResources) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static DatabaseIdentity DeserializeDatabaseIdentity(JsonElement element) + { + Optional type = default; + Optional tenantId = default; + Optional> userAssignedIdentities = default; + Optional> delegatedResources = 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; + } + if (property.NameEquals("delegatedResources")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, Delegation.DeserializeDelegation(property0.Value)); + } + delegatedResources = dictionary; + continue; + } + } + return new DatabaseIdentity(Optional.ToNullable(type), Optional.ToNullable(tenantId), Optional.ToDictionary(userAssignedIdentities), Optional.ToDictionary(delegatedResources)); + } + } +} 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..947fd98db6d8 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs @@ -0,0 +1,47 @@ +// 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(); + DelegatedResources = 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. + /// Resources delegated to the database - Internal Use Only. + internal DatabaseIdentity(DatabaseIdentityType? type, Guid? tenantId, IDictionary userAssignedIdentities, IDictionary delegatedResources) + { + Type = type; + TenantId = tenantId; + UserAssignedIdentities = userAssignedIdentities; + DelegatedResources = delegatedResources; + } + + /// The identity type. + public DatabaseIdentityType? Type { 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; } + /// Resources delegated to the database - Internal Use Only. + public IDictionary DelegatedResources { 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/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/DatabaseUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.Serialization.cs index bc9a2063e110..df305d1e650f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.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,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(PrimaryDelegatedIdentityClientId)) + { + writer.WritePropertyName("primaryDelegatedIdentityClientId"); + writer.WriteStringValue(PrimaryDelegatedIdentityClientId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs index bdcdf4481a0b..f6dc6594f98f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs @@ -22,6 +22,8 @@ public DatabaseUpdate() /// The name and tier of the SKU. public Sku Sku { get; set; } + /// Database identity. + public DatabaseIdentity Identity { get; set; } /// Resource tags. public IDictionary Tags { get; } /// @@ -101,9 +103,9 @@ public DatabaseUpdate() /// 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,9 @@ public DatabaseUpdate() 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 Primary Delegated Identity Client id used for per database CMK - for internal use only. + public Guid? PrimaryDelegatedIdentityClientId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs new file mode 100644 index 000000000000..fbf22ed21450 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class Delegation : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"); + writer.WriteStringValue(ResourceId); + } + writer.WriteEndObject(); + } + + internal static Delegation DeserializeDelegation(JsonElement element) + { + Optional resourceId = default; + Optional tenantId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId")) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantId = property.Value.GetGuid(); + continue; + } + } + return new Delegation(resourceId.Value, Optional.ToNullable(tenantId)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.cs new file mode 100644 index 000000000000..f70659e50303 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Delegated Resource Properties - Internal Use Only. + public partial class Delegation + { + /// Initializes a new instance of Delegation. + public Delegation() + { + } + + /// Initializes a new instance of Delegation. + /// The resource id of the source resource - Internal Use Only. + /// AAD tenant guid of the source resource identity - Internal Use Only. + internal Delegation(string resourceId, Guid? tenantId) + { + ResourceId = resourceId; + TenantId = tenantId; + } + + /// The resource id of the source resource - Internal Use Only. + public string ResourceId { get; set; } + /// AAD tenant guid of the source resource identity - Internal Use Only. + public Guid? TenantId { get; } + } +} 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 c3bb3a244535..4edba3c3738b 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/ElasticPoolUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.Serialization.cs index f20d8fd21790..16a1f1fcbfe2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.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/ElasticPoolUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.cs index 4809ffd2e0a7..5271431a7f44 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.cs @@ -33,5 +33,7 @@ public ElasticPoolUpdate() 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/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/IPv6FirewallRuleList.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleList.cs new file mode 100644 index 000000000000..62b9c2efe49c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IPv6FirewallRuleList.cs @@ -0,0 +1,26 @@ +// 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 IPv6 server firewall rules. + internal partial class IPv6FirewallRuleList + { + /// Initializes a new instance of IPv6FirewallRuleList. + internal IPv6FirewallRuleList() + { + Values = new ChangeTrackingList(); + } + + /// Gets the values. + public IReadOnlyList Values { get; } + } +} 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 869ceb7c9d30..0ed589a1e6f9 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 @@ -126,10 +126,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)) { @@ -151,6 +151,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(); } @@ -187,11 +192,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")) @@ -418,14 +425,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")) @@ -458,11 +475,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/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/ManagedInstanceUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.Serialization.cs index 95e1cf08e8ee..46324dd0c0f9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.Serialization.cs @@ -123,10 +123,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)) { @@ -148,6 +148,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/ManagedInstanceUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.cs index 47611546056f..6f489be5c472 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.cs @@ -85,8 +85,10 @@ public ManagedInstanceUpdate() 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 ManagedInstanceUpdate() 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/OperationsHealth.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.cs deleted file mode 100644 index 40261185c06c..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 : Resource - { - /// Initializes a new instance of OperationsHealth. - public OperationsHealth() - { - } - - /// Initializes a new instance of OperationsHealth. - /// The id. - /// The name. - /// The type. - /// The systemData. - /// Operation name for the service. - /// Operation health status of the service. - /// Health status description. - internal OperationsHealth(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, string namePropertiesName, string health, string description) : base(id, name, type, 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 b7250790a683..ea48be3760d1 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/OperationsHealth.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificateData.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/ServerTrustCertificateData.Serialization.cs index 4e98b638b99c..8f9b6f8250a4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustCertificateData.Serialization.cs @@ -9,28 +9,33 @@ using Azure.Core; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Sql.Models +namespace Azure.ResourceManager.Sql { - public partial class OperationsHealth : IUtf8JsonSerializable + 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 OperationsHealth DeserializeOperationsHealth(JsonElement element) + internal static ServerTrustCertificateData DeserializeServerTrustCertificateData(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; + Optional thumbprint = default; + Optional certificateName = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -62,26 +67,26 @@ internal static OperationsHealth DeserializeOperationsHealth(JsonElement element } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("name")) + if (property0.NameEquals("publicBlob")) { - name0 = property0.Value.GetString(); + publicBlob = property0.Value.GetString(); continue; } - if (property0.NameEquals("health")) + if (property0.NameEquals("thumbprint")) { - health = property0.Value.GetString(); + thumbprint = property0.Value.GetString(); continue; } - if (property0.NameEquals("description")) + if (property0.NameEquals("certificateName")) { - description = property0.Value.GetString(); + certificateName = property0.Value.GetString(); continue; } } continue; } } - return new OperationsHealth(id, name, type, systemData, name0.Value, health.Value, description.Value); + 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..9429bde62587 --- /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 the server trust certificates which are used for secure communication between SQL On-Prem instance and the given Sql Managed 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..cb50a10bd634 --- /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(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.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..b6aa1ff53a7f --- /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? type) + { + PrincipalId = principalId; + ClientId = clientId; + TenantId = tenantId; + Type = type; + } + + /// 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? Type { 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 b163e683c0cf..a10641e781be 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(PrimaryDelegatedIdentityClientId)) + { + writer.WritePropertyName("primaryDelegatedIdentityClientId"); + writer.WriteStringValue(PrimaryDelegatedIdentityClientId.Value); + } 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 primaryDelegatedIdentityClientId = 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,31 @@ 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("primaryDelegatedIdentityClientId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + primaryDelegatedIdentityClientId = property0.Value.GetGuid(); + 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), Optional.ToNullable(primaryDelegatedIdentityClientId)); } } } 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/DistributedAvailabilityGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs new file mode 100644 index 000000000000..7b406c03c1b5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs @@ -0,0 +1,672 @@ +// 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.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DistributedAvailabilityGroupsRestOperations + { + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of DistributedAvailabilityGroupsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// is null. + public DistributedAvailabilityGroupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? "2021-05-01-preview"; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, 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"); + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> ListByInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response ListByInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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"); + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters) + { + 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(parameters); + request.Content = content; + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(nameof(distributedAvailabilityGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(nameof(distributedAvailabilityGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(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; + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response Delete(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters) + { + 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(parameters); + request.Content = content; + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(nameof(distributedAvailabilityGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response Update(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (distributedAvailabilityGroupName == null) + { + throw new ArgumentNullException(nameof(distributedAvailabilityGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(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"); + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> ListByInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response ListByInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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 fbdbba715af9..548984b980da 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ElasticPoolsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ElasticPoolsRestOperations.cs @@ -266,7 +266,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; @@ -298,7 +298,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res /// The number of elements in the collection to skip. /// The cancellation token to use. /// , , or is null. - 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) { if (subscriptionId == null) { @@ -336,7 +336,7 @@ public async Task> ListByServerAsync(string subs /// The number of elements in the collection to skip. /// The cancellation token to use. /// , , or is null. - 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) { if (subscriptionId == null) { @@ -900,7 +900,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; @@ -922,7 +922,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// The number of elements in the collection to skip. /// The cancellation token to use. /// , , , or is null. - 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) { if (nextLink == null) { @@ -965,7 +965,7 @@ public async Task> ListByServerNextPageAsync(str /// The number of elements in the collection to skip. /// The cancellation token to use. /// , , , or is null. - 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) { if (nextLink == null) { 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..e13c0d1781aa --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/IPv6FirewallRulesRestOperations.cs @@ -0,0 +1,566 @@ +// 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.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class IPv6FirewallRulesRestOperations + { + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of IPv6FirewallRulesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// is null. + public IPv6FirewallRulesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? "2021-08-01-preview"; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, applicationId); + } + + 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"); + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRuleData parameters) + { + 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(parameters); + request.Content = content; + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRuleData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(nameof(firewallRuleName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName, parameters); + 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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRuleData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(nameof(firewallRuleName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, firewallRuleName, parameters); + _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 _clientDiagnostics.CreateRequestFailedException(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; + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + 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"); + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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"); + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> ListByServerNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response ListByServerNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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 6339fb6272ec..a6e6b2fdf1c0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs @@ -35,7 +35,7 @@ internal partial class LongTermRetentionBackupsRestOperations public LongTermRetentionBackupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-11-01-preview"; + this.apiVersion = apiVersion ?? "2021-05-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, 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 bb23765332db..943491538da2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs @@ -35,7 +35,7 @@ internal partial class LongTermRetentionManagedInstanceBackupsRestOperations public LongTermRetentionManagedInstanceBackupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-11-01-preview"; + this.apiVersion = apiVersion ?? "2021-05-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, 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 d9f5ec3104d1..96d5a7012111 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs @@ -35,7 +35,7 @@ internal partial class ManagedInstancesRestOperations public ManagedInstancesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-11-01-preview"; + this.apiVersion = apiVersion ?? "2021-05-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, 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 66f83cec232c..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs +++ /dev/null @@ -1,215 +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.Core; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - internal partial class OperationsHealthRestOperations - { - private Uri endpoint; - private string apiVersion; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - private readonly string _userAgent; - - /// Initializes a new instance of OperationsHealthRestOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// is null. - public OperationsHealthRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-11-01-preview"; - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, 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"); - message.SetProperty("SDKUserAgent", _userAgent); - 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. - public async Task> ListByLocationAsync(string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - if (locationName == null) - { - throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// 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. - public Response ListByLocation(string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - if (locationName == null) - { - throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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"); - message.SetProperty("SDKUserAgent", _userAgent); - 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. - public async Task> ListByLocationNextPageAsync(string nextLink, string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - if (locationName == null) - { - throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// 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. - public Response ListByLocationNextPage(string nextLink, string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - if (locationName == null) - { - throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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 0514963e77b1..3481d0307968 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs @@ -35,7 +35,7 @@ internal partial class RestorableDroppedDatabasesRestOperations public RestorableDroppedDatabasesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2021-02-01-preview"; + this.apiVersion = apiVersion ?? "2021-05-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, 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 3224fd36ae7a..ab938dfc25ae 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs @@ -35,7 +35,7 @@ internal partial class RestorableDroppedManagedDatabasesRestOperations public RestorableDroppedManagedDatabasesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2021-02-01-preview"; + this.apiVersion = apiVersion ?? "2021-05-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, 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..2668dac228f7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerTrustCertificatesRestOperations.cs @@ -0,0 +1,560 @@ +// 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.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ServerTrustCertificatesRestOperations + { + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of ServerTrustCertificatesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// is null. + public ServerTrustCertificatesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? "2021-05-01-preview"; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = Core.HttpMessageUtilities.GetUserAgentName(this, applicationId); + } + + 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"); + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (certificateName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (certificateName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, ServerTrustCertificateData parameters) + { + 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(parameters); + request.Content = content; + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, ServerTrustCertificateData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (certificateName == null) + { + throw new ArgumentNullException(nameof(certificateName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, ServerTrustCertificateData parameters, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (certificateName == null) + { + throw new ArgumentNullException(nameof(certificateName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, certificateName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(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; + message.SetProperty("SDKUserAgent", _userAgent); + 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. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (certificateName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// 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. + public Response Delete(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (certificateName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + 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"); + message.SetProperty("SDKUserAgent", _userAgent); + return message; + } + + /// Gets a list of the server trust certificates which are used for secure communication between SQL On-Prem instance and 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. + public async Task> ListByInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of the server trust certificates which are used for secure communication between SQL On-Prem instance and 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. + public Response ListByInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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"); + message.SetProperty("SDKUserAgent", _userAgent); + return message; + } + + /// Gets a list of the server trust certificates which are used for secure communication between SQL On-Prem instance and 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. + public async Task> ListByInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of the server trust certificates which are used for secure communication between SQL On-Prem instance and 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. + public Response ListByInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(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 _clientDiagnostics.CreateRequestFailedException(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 ee10822b7bf6..75a9a89dd8be 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 type, SystemData systemData, Models.Sku sku, string location, IDictionary tags, string databaseName, long? maxSizeBytes, string elasticPoolId, DateTimeOffset? creationDate, DateTimeOffset? deletionDate, DateTimeOffset? earliestRestoreDate, RestorableDroppedDatabasePropertiesBackupStorageRedundancy? backupStorageRedundancy) : base(id, name, type, systemData) + internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, Models.Sku sku, string location, IDictionary tags, string databaseName, long? maxSizeBytes, DateTimeOffset? creationDate, DateTimeOffset? deletionDate, DateTimeOffset? earliestRestoreDate, BackupStorageRedundancy? backupStorageRedundancy) : base(id, name, type, systemData) { Sku = sku; Location = location; Tags = tags; DatabaseName = databaseName; MaxSizeBytes = maxSizeBytes; - ElasticPoolId = elasticPoolId; CreationDate = creationDate; DeletionDate = deletionDate; EarliestRestoreDate = earliestRestoreDate; @@ -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? CreationDate { 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? EarliestRestoreDate { 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/ServerTrustCertificate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificate.cs new file mode 100644 index 000000000000..36ea39baa6d2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificate.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A Class representing a ServerTrustCertificate along with the instance operations that can be performed on it. + public partial class ServerTrustCertificate : 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 ServerTrustCertificate() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServerTrustCertificate(ArmClient armClient, ServerTrustCertificateData data) : this(armClient, 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 ServerTrustCertificate(ArmClient armClient, ResourceIdentifier id) : base(armClient, id) + { + _serverTrustCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, DiagnosticOptions); + ArmClient.TryGetApiVersion(ResourceType, out string serverTrustCertificateApiVersion); + _serverTrustCertificateRestClient = new ServerTrustCertificatesRestOperations(_serverTrustCertificateClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, 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)); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// OperationId: ServerTrustCertificates_Get + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificate.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 await _serverTrustCertificateClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ServerTrustCertificate(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// OperationId: ServerTrustCertificates_Get + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificate.Get"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _serverTrustCertificateClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificate(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificate.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificate.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// OperationId: ServerTrustCertificates_Delete + /// Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificate.Delete"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServerTrustCertificateDeleteOperation(_serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// OperationId: ServerTrustCertificates_Delete + /// Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual ServerTrustCertificateDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificate.Delete"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ServerTrustCertificateDeleteOperation(_serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} 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..5886191caa47 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustCertificateCollection.cs @@ -0,0 +1,373 @@ +// 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.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing collection of ServerTrustCertificate and their operations over its parent. + 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 resource representing the parent resource. + internal ServerTrustCertificateCollection(ArmResource parent) : base(parent) + { + _serverTrustCertificateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ServerTrustCertificate.ResourceType.Namespace, DiagnosticOptions); + ArmClient.TryGetApiVersion(ServerTrustCertificate.ResourceType, out string serverTrustCertificateApiVersion); + _serverTrustCertificateRestClient = new ServerTrustCertificatesRestOperations(_serverTrustCertificateClientDiagnostics, Pipeline, DiagnosticOptions.ApplicationId, BaseUri, serverTrustCertificateApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstance.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstance.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustCertificates_CreateOrUpdate + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// Name of of the certificate to upload. + /// The server trust certificate info. + /// The cancellation token to use. + /// is empty. + /// or is null. + public virtual ServerTrustCertificateCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string certificateName, ServerTrustCertificateData parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, parameters, cancellationToken); + var operation = new ServerTrustCertificateCreateOrUpdateOperation(ArmClient, _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, parameters).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustCertificates_CreateOrUpdate + /// Uploads a server trust certificate from box to Sql Managed Instance. + /// Waits for the completion of the long running operations. + /// Name of of the certificate to upload. + /// The server trust certificate info. + /// The cancellation token to use. + /// is empty. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string certificateName, ServerTrustCertificateData parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, parameters, cancellationToken).ConfigureAwait(false); + var operation = new ServerTrustCertificateCreateOrUpdateOperation(ArmClient, _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, parameters).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustCertificates_Get + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is 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 _serverTrustCertificateClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificate(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustCertificates_Get + /// Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual 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 await _serverTrustCertificateClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ServerTrustCertificate(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is empty. + /// is null. + public virtual Response GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serverTrustCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificate(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serverTrustCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ServerTrustCertificate(ArmClient, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is 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 = GetIfExists(certificateName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual 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 GetIfExistsAsync(certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustCertificates_ListByInstance + /// Gets a list of the server trust certificates which are used for secure communication between SQL On-Prem instance and the given Sql Managed Instance. + /// 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 ServerTrustCertificate(ArmClient, 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 ServerTrustCertificate(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// OperationId: ServerTrustCertificates_ListByInstance + /// Gets a list of the server trust certificates which are used for secure communication between SQL On-Prem instance and the given Sql Managed Instance. + /// 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 ServerTrustCertificate(ArmClient, 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 ServerTrustCertificate(ArmClient, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + 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..ac99495cbc35 --- /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 : Resource + { + /// Initializes a new instance of ServerTrustCertificateData. + public ServerTrustCertificateData() + { + } + + /// Initializes a new instance of ServerTrustCertificateData. + /// The id. + /// The name. + /// The type. + /// The systemData. + /// The certificate public blob. + /// The certificate thumbprint. + /// The certificate name. + internal ServerTrustCertificateData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, string publicBlob, string thumbprint, string certificateName) : base(id, name, type, 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/SqlDatabaseData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseData.cs index 4f745cc3e839..201370840bae 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. /// @@ -100,11 +101,14 @@ 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 type, SystemData systemData, IDictionary tags, AzureLocation location, Models.Sku sku, string kind, string managedBy, CreateMode? createMode, string collation, long? maxSizeBytes, SampleSchemaName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationDate, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInTime, DateTimeOffset? sourceDatabaseDeletionDate, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreDate, DatabaseReadScale? readScale, int? highAvailabilityReplicaCount, SecondaryType? secondaryType, Models.Sku currentSku, int? autoPauseDelay, CurrentBackupStorageRedundancy? currentBackupStorageRedundancy, RequestedBackupStorageRedundancy? requestedBackupStorageRedundancy, double? minCapacity, DateTimeOffset? pausedDate, DateTimeOffset? resumedDate, string maintenanceConfigurationId, bool? isLedgerOn, bool? isInfraEncryptionEnabled) : base(id, name, type, systemData, tags, location) + /// The Client id used for cross tenant per database CMK scenario. + /// The Primary Delegated Identity Client id used for per database CMK - for internal use only. + internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary tags, AzureLocation location, Models.Sku sku, string kind, string managedBy, DatabaseIdentity identity, CreateMode? createMode, string collation, long? maxSizeBytes, SampleSchemaName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationDate, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInTime, DateTimeOffset? sourceDatabaseDeletionDate, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreDate, DatabaseReadScale? readScale, int? highAvailabilityReplicaCount, SecondaryType? secondaryType, Models.Sku currentSku, int? autoPauseDelay, BackupStorageRedundancy? currentBackupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy, double? minCapacity, DateTimeOffset? pausedDate, DateTimeOffset? resumedDate, string maintenanceConfigurationId, bool? isLedgerOn, bool? isInfraEncryptionEnabled, Guid? federatedClientId, Guid? primaryDelegatedIdentityClientId) : base(id, name, type, systemData, tags, location) { Sku = sku; Kind = kind; ManagedBy = managedBy; + Identity = identity; CreateMode = createMode; Collation = collation; MaxSizeBytes = maxSizeBytes; @@ -142,6 +146,8 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType type, MaintenanceConfigurationId = maintenanceConfigurationId; IsLedgerOn = isLedgerOn; IsInfraEncryptionEnabled = isInfraEncryptionEnabled; + FederatedClientId = federatedClientId; + PrimaryDelegatedIdentityClientId = primaryDelegatedIdentityClientId; } /// @@ -163,6 +169,8 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType type, 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. /// @@ -240,9 +248,9 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType type, /// 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 +263,9 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType type, 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 Primary Delegated Identity Client id used for per database CMK - for internal use only. + public Guid? PrimaryDelegatedIdentityClientId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServer.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServer.cs index 4465edbd57a6..8b1bd8c4dcc2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServer.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServer.cs @@ -1220,5 +1220,15 @@ public virtual ServerConnectionPolicyCollection GetServerConnectionPolicies() return new ServerConnectionPolicyCollection(this); } #endregion + + #region IPv6FirewallRule + + /// Gets a collection of IPv6FirewallRules in the SqlServer. + /// An object representing collection of IPv6FirewallRules and their operations over a SqlServer. + public virtual IPv6FirewallRuleCollection GetIPv6FirewallRules() + { + return new IPv6FirewallRuleCollection(this); + } + #endregion } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index 503b03524f68..bc145d057af5 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/ed220b62ba2007e6659cb3dded501765d1593e7c/specification/sql/resource-manager/readme.md namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated model-namespace: false