diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index d712bbfbede32..0fdc0f74750cb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -63,6 +63,28 @@ public virtual InstancePoolCollection GetInstancePools() return GetCachedClient(Client => new InstancePoolCollection(Client, Id)); } + /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. + /// The name of the region where the resource is located. + /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. + public virtual ServerTrustGroupCollection GetServerTrustGroups(string locationName) + { + return new ServerTrustGroupCollection(Client, Id, locationName); + } + + /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. + /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. + public virtual VirtualClusterCollection GetVirtualClusters() + { + return GetCachedClient(Client => new VirtualClusterCollection(Client, Id)); + } + + /// Gets a collection of SqlServerResources in the ResourceGroupResource. + /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. + public virtual SqlServerCollection GetSqlServers() + { + return GetCachedClient(Client => new SqlServerCollection(Client, Id)); + } + /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. /// The location of the database. /// The name of the server. @@ -90,28 +112,6 @@ public virtual ManagedInstanceCollection GetManagedInstances() return GetCachedClient(Client => new ManagedInstanceCollection(Client, Id)); } - /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. - /// The name of the region where the resource is located. - /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. - public virtual ServerTrustGroupCollection GetServerTrustGroups(string locationName) - { - return new ServerTrustGroupCollection(Client, Id, locationName); - } - - /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. - /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. - public virtual VirtualClusterCollection GetVirtualClusters() - { - return GetCachedClient(Client => new VirtualClusterCollection(Client, Id)); - } - - /// Gets a collection of SqlServerResources in the ResourceGroupResource. - /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. - public virtual SqlServerCollection GetSqlServers() - { - return GetCachedClient(Client => new SqlServerCollection(Client, Id)); - } - /// /// Lists the long term retention backups for a given location. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs index 58f7250fa4e5e..da2d10cb50a08 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -76,6 +76,100 @@ public static Response GetDeletedServer(this Subscription return subscriptionResource.GetDeletedServers(locationName).Get(deletedServerName, cancellationToken); } + /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. + public static SubscriptionUsageCollection GetSubscriptionUsages(this SubscriptionResource subscriptionResource, string locationName) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetSubscriptionUsages(locationName); + } + + /// + /// Gets a subscription usage metric. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// Operation Id: SubscriptionUsages_Get + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// Name of usage metric to return. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetSubscriptionUsageAsync(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) + { + return await subscriptionResource.GetSubscriptionUsages(locationName).GetAsync(usageName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a subscription usage metric. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// Operation Id: SubscriptionUsages_Get + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// Name of usage metric to return. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetSubscriptionUsage(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) + { + return subscriptionResource.GetSubscriptionUsages(locationName).Get(usageName, cancellationToken); + } + + /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. + /// The instance the method will execute against. + /// The String to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. + public static SqlTimeZoneCollection GetSqlTimeZones(this SubscriptionResource subscriptionResource, string locationName) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetSqlTimeZones(locationName); + } + + /// + /// Gets a managed instance time zone. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// Operation Id: TimeZones_Get + /// + /// The instance the method will execute against. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetSqlTimeZoneAsync(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + return await subscriptionResource.GetSqlTimeZones(locationName).GetAsync(timeZoneId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed instance time zone. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// Operation Id: TimeZones_Get + /// + /// The instance the method will execute against. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetSqlTimeZone(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + return subscriptionResource.GetSqlTimeZones(locationName).Get(timeZoneId, cancellationToken); + } + /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. /// The instance the method will execute against. /// The location of the database. @@ -186,100 +280,6 @@ public static Response Gets a collection of SubscriptionUsageResources in the SubscriptionResource. - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. - public static SubscriptionUsageCollection GetSubscriptionUsages(this SubscriptionResource subscriptionResource, string locationName) - { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSubscriptionUsages(locationName); - } - - /// - /// Gets a subscription usage metric. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} - /// Operation Id: SubscriptionUsages_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// Name of usage metric to return. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static async Task> GetSubscriptionUsageAsync(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) - { - return await subscriptionResource.GetSubscriptionUsages(locationName).GetAsync(usageName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a subscription usage metric. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} - /// Operation Id: SubscriptionUsages_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// Name of usage metric to return. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static Response GetSubscriptionUsage(this SubscriptionResource subscriptionResource, string locationName, string usageName, CancellationToken cancellationToken = default) - { - return subscriptionResource.GetSubscriptionUsages(locationName).Get(usageName, cancellationToken); - } - - /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. - /// The instance the method will execute against. - /// The String to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. - public static SqlTimeZoneCollection GetSqlTimeZones(this SubscriptionResource subscriptionResource, string locationName) - { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSqlTimeZones(locationName); - } - - /// - /// Gets a managed instance time zone. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} - /// Operation Id: TimeZones_Get - /// - /// The instance the method will execute against. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static async Task> GetSqlTimeZoneAsync(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) - { - return await subscriptionResource.GetSqlTimeZones(locationName).GetAsync(timeZoneId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a managed instance time zone. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} - /// Operation Id: TimeZones_Get - /// - /// The instance the method will execute against. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static Response GetSqlTimeZone(this SubscriptionResource subscriptionResource, string locationName, string timeZoneId, CancellationToken cancellationToken = default) - { - return subscriptionResource.GetSqlTimeZones(locationName).Get(timeZoneId, cancellationToken); - } - /// /// Gets a list of all deleted servers in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers @@ -363,9 +363,131 @@ public static async Task> GetByLocationCapability /// is null. public static Response GetByLocationCapability(this SubscriptionResource subscriptionResource, string locationName, CapabilityGroup? include = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetByLocationCapability(locationName, include, cancellationToken); + } + + /// + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); + } + + /// + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSyncDatabaseIdsSyncGroups(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); + } + + /// + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetVirtualClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetVirtualClustersAsync(cancellationToken); + } + + /// + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetVirtualClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetVirtualClusters(cancellationToken); + } + + /// + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List + /// + /// The instance the method will execute against. + /// The child resources to include in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSqlServersAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetSqlServersAsync(expand, cancellationToken); + } + + /// + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List + /// + /// The instance the method will execute against. + /// The child resources to include in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSqlServers(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetSqlServers(expand, cancellationToken); + } + + /// + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability + /// + /// The instance the method will execute against. + /// The name availability request parameters. + /// The cancellation token to use. + /// is null. + public static async Task> CheckNameAvailabilityServerAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(parameters, nameof(parameters)); + + return await GetExtensionClient(subscriptionResource).CheckNameAvailabilityServerAsync(parameters, cancellationToken).ConfigureAwait(false); + } + + /// + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability + /// + /// The instance the method will execute against. + /// The name availability request parameters. + /// The cancellation token to use. + /// is null. + public static Response CheckNameAvailabilityServer(this SubscriptionResource subscriptionResource, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(parameters, nameof(parameters)); - return GetExtensionClient(subscriptionResource).GetByLocationCapability(locationName, include, cancellationToken); + return GetExtensionClient(subscriptionResource).CheckNameAvailabilityServer(parameters, cancellationToken); } /// @@ -564,258 +686,229 @@ public static Pageable GetManagedInstances(this Subscri return GetExtensionClient(subscriptionResource).GetManagedInstances(expand, cancellationToken); } - /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetOperationsHealthsByLocationAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetOperationsHealthsByLocationAsync(locationName, cancellationToken); + return resourceGroupResource.GetCachedClient((client) => + { + return new ResourceGroupResourceExtensionClient(client, resourceGroupResource.Id); + } + ); } - /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation - /// - /// The instance the method will execute against. + /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. + /// The instance the method will execute against. /// The name of the region where the resource is located. - /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetOperationsHealthsByLocation(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + /// An object representing collection of InstanceFailoverGroupResources and their operations over a InstanceFailoverGroupResource. + public static InstanceFailoverGroupCollection GetInstanceFailoverGroups(this ResourceGroupResource resourceGroupResource, string locationName) { Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - return GetExtensionClient(subscriptionResource).GetOperationsHealthsByLocation(locationName, cancellationToken); + return GetExtensionClient(resourceGroupResource).GetInstanceFailoverGroups(locationName); } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Gets a failover group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// Operation Id: InstanceFailoverGroups_Get /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The name of the region where the resource is located. + /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetInstanceFailoverGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); + return await resourceGroupResource.GetInstanceFailoverGroups(locationName).GetAsync(failoverGroupName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Gets a failover group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// Operation Id: InstanceFailoverGroups_Get /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The name of the region where the resource is located. + /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetSyncDatabaseIdsSyncGroups(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetInstanceFailoverGroup(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); + return resourceGroupResource.GetInstanceFailoverGroups(locationName).Get(failoverGroupName, cancellationToken); } - /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List - /// - /// The instance the method will execute against. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetVirtualClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) { - return GetExtensionClient(subscriptionResource).GetVirtualClustersAsync(cancellationToken); + return GetExtensionClient(resourceGroupResource).GetInstancePools(); } /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List + /// Gets an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// Operation Id: InstancePools_Get /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetVirtualClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionResource).GetVirtualClusters(cancellationToken); + return await resourceGroupResource.GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List + /// Gets an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// Operation Id: InstancePools_Get /// - /// The instance the method will execute against. - /// The child resources to include in the response. + /// The instance the method will execute against. + /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetSqlServersAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionResource).GetSqlServersAsync(expand, cancellationToken); + return resourceGroupResource.GetInstancePools().Get(instancePoolName, cancellationToken); } - /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List - /// - /// The instance the method will execute against. - /// The child resources to include in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetSqlServers(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. + public static ServerTrustGroupCollection GetServerTrustGroups(this ResourceGroupResource resourceGroupResource, string locationName) { - return GetExtensionClient(subscriptionResource).GetSqlServers(expand, cancellationToken); + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + return GetExtensionClient(resourceGroupResource).GetServerTrustGroups(locationName); } /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability + /// Gets a server trust group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// Operation Id: ServerTrustGroups_Get /// - /// The instance the method will execute against. - /// The name availability request parameters. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The name of the server trust group. /// The cancellation token to use. - /// is null. - public static async Task> CheckNameAvailabilityServerAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static async Task> GetServerTrustGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(parameters, nameof(parameters)); - - return await GetExtensionClient(subscriptionResource).CheckNameAvailabilityServerAsync(parameters, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetServerTrustGroups(locationName).GetAsync(serverTrustGroupName, cancellationToken).ConfigureAwait(false); } /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability + /// Gets a server trust group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// Operation Id: ServerTrustGroups_Get /// - /// The instance the method will execute against. - /// The name availability request parameters. + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The name of the server trust group. /// The cancellation token to use. - /// is null. - public static Response CheckNameAvailabilityServer(this SubscriptionResource subscriptionResource, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(parameters, nameof(parameters)); - - return GetExtensionClient(subscriptionResource).CheckNameAvailabilityServer(parameters, cancellationToken); - } - - private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [ForwardsClientCalls] + public static Response GetServerTrustGroup(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCachedClient((client) => - { - return new ResourceGroupResourceExtensionClient(client, resourceGroupResource.Id); - } - ); + return resourceGroupResource.GetServerTrustGroups(locationName).Get(serverTrustGroupName, cancellationToken); } - /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. + /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of InstanceFailoverGroupResources and their operations over a InstanceFailoverGroupResource. - public static InstanceFailoverGroupCollection GetInstanceFailoverGroups(this ResourceGroupResource resourceGroupResource, string locationName) + /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. + public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupResource resourceGroupResource) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(resourceGroupResource).GetInstanceFailoverGroups(locationName); + return GetExtensionClient(resourceGroupResource).GetVirtualClusters(); } /// - /// Gets a failover group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} - /// Operation Id: InstanceFailoverGroups_Get + /// Gets a virtual cluster. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} + /// Operation Id: VirtualClusters_Get /// /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the failover group. + /// The name of the virtual cluster. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static async Task> GetInstanceFailoverGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) + public static async Task> GetVirtualClusterAsync(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetInstanceFailoverGroups(locationName).GetAsync(failoverGroupName, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetVirtualClusters().GetAsync(virtualClusterName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a failover group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} - /// Operation Id: InstanceFailoverGroups_Get + /// Gets a virtual cluster. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} + /// Operation Id: VirtualClusters_Get /// /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the failover group. + /// The name of the virtual cluster. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static Response GetInstanceFailoverGroup(this ResourceGroupResource resourceGroupResource, string locationName, string failoverGroupName, CancellationToken cancellationToken = default) + public static Response GetVirtualCluster(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetInstanceFailoverGroups(locationName).Get(failoverGroupName, cancellationToken); + return resourceGroupResource.GetVirtualClusters().Get(virtualClusterName, cancellationToken); } - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// Gets a collection of SqlServerResources in the ResourceGroupResource. /// The instance the method will execute against. - /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. - public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. + public static SqlServerCollection GetSqlServers(this ResourceGroupResource resourceGroupResource) { - return GetExtensionClient(resourceGroupResource).GetInstancePools(); + return GetExtensionClient(resourceGroupResource).GetSqlServers(); } /// - /// Gets an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// Operation Id: InstancePools_Get + /// Gets a server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// Operation Id: Servers_Get /// /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. + /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + public static async Task> GetSqlServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetSqlServers().GetAsync(serverName, expand, cancellationToken).ConfigureAwait(false); } /// - /// Gets an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// Operation Id: InstancePools_Get + /// Gets a server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// Operation Id: Servers_Get /// /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. + /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. + /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + public static Response GetSqlServer(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetInstancePools().Get(instancePoolName, cancellationToken); + return resourceGroupResource.GetSqlServers().Get(serverName, expand, cancellationToken); } /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. @@ -970,135 +1063,6 @@ public static Response GetManagedInstance(this Resource return resourceGroupResource.GetManagedInstances().Get(managedInstanceName, expand, cancellationToken); } - /// Gets a collection of ServerTrustGroupResources in the ResourceGroupResource. - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An object representing collection of ServerTrustGroupResources and their operations over a ServerTrustGroupResource. - public static ServerTrustGroupCollection GetServerTrustGroups(this ResourceGroupResource resourceGroupResource, string locationName) - { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetExtensionClient(resourceGroupResource).GetServerTrustGroups(locationName); - } - - /// - /// Gets a server trust group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} - /// Operation Id: ServerTrustGroups_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the server trust group. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static async Task> GetServerTrustGroupAsync(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) - { - return await resourceGroupResource.GetServerTrustGroups(locationName).GetAsync(serverTrustGroupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a server trust group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} - /// Operation Id: ServerTrustGroups_Get - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the server trust group. - /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - [ForwardsClientCalls] - public static Response GetServerTrustGroup(this ResourceGroupResource resourceGroupResource, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) - { - return resourceGroupResource.GetServerTrustGroups(locationName).Get(serverTrustGroupName, cancellationToken); - } - - /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. - /// The instance the method will execute against. - /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. - public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupResource resourceGroupResource) - { - return GetExtensionClient(resourceGroupResource).GetVirtualClusters(); - } - - /// - /// Gets a virtual cluster. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} - /// Operation Id: VirtualClusters_Get - /// - /// The instance the method will execute against. - /// The name of the virtual cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetVirtualClusterAsync(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) - { - return await resourceGroupResource.GetVirtualClusters().GetAsync(virtualClusterName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a virtual cluster. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} - /// Operation Id: VirtualClusters_Get - /// - /// The instance the method will execute against. - /// The name of the virtual cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetVirtualCluster(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) - { - return resourceGroupResource.GetVirtualClusters().Get(virtualClusterName, cancellationToken); - } - - /// Gets a collection of SqlServerResources in the ResourceGroupResource. - /// The instance the method will execute against. - /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. - public static SqlServerCollection GetSqlServers(this ResourceGroupResource resourceGroupResource) - { - return GetExtensionClient(resourceGroupResource).GetSqlServers(); - } - - /// - /// Gets a server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} - /// Operation Id: Servers_Get - /// - /// The instance the method will execute against. - /// The name of the server. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetSqlServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) - { - return await resourceGroupResource.GetSqlServers().GetAsync(serverName, expand, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} - /// Operation Id: Servers_Get - /// - /// The instance the method will execute against. - /// The name of the server. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetSqlServer(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) - { - return resourceGroupResource.GetSqlServers().Get(serverName, expand, cancellationToken); - } - /// /// Lists the long term retention backups for a given location. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups @@ -1362,25 +1326,6 @@ public static ElasticPoolResource GetElasticPoolResource(this ArmClient client, } #endregion - #region ReplicationLinkResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ReplicationLinkResource GetReplicationLinkResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ReplicationLinkResource.ValidateResourceId(id); - return new ReplicationLinkResource(client, id); - } - ); - } - #endregion - #region ServerCommunicationLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -2128,90 +2073,14 @@ public static JobTargetGroupResource GetJobTargetGroupResource(this ArmClient cl /// You can use to create a from its components. /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static JobVersionResource GetJobVersionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - JobVersionResource.ValidateResourceId(id); - return new JobVersionResource(client, id); - } - ); - } - #endregion - - #region SubscriptionLongTermRetentionBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); - return new SubscriptionLongTermRetentionBackupResource(client, id); - } - ); - } - #endregion - - #region ResourceGroupLongTermRetentionBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionBackupResource(client, id); - } - ); - } - #endregion - - #region SubscriptionLongTermRetentionManagedInstanceBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionLongTermRetentionManagedInstanceBackupResource GetSubscriptionLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - SubscriptionLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); - return new SubscriptionLongTermRetentionManagedInstanceBackupResource(client, id); - } - ); - } - #endregion - - #region ResourceGroupLongTermRetentionManagedInstanceBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupLongTermRetentionManagedInstanceBackupResource GetResourceGroupLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) + /// The resource ID of the resource to get. + /// Returns a object. + public static JobVersionResource GetJobVersionResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ResourceGroupLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionManagedInstanceBackupResource(client, id); + JobVersionResource.ValidateResourceId(id); + return new JobVersionResource(client, id); } ); } @@ -2369,44 +2238,6 @@ public static ManagedDatabaseSecurityAlertPolicyResource GetManagedDatabaseSecur } #endregion - #region ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource GetManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); - return new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(client, id); - } - ); - } - #endregion - - #region ServerDatabaseSchemaTableColumnSensitivityLabelResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ServerDatabaseSchemaTableColumnSensitivityLabelResource GetServerDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ServerDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); - return new ServerDatabaseSchemaTableColumnSensitivityLabelResource(client, id); - } - ); - } - #endregion - #region ManagedTransparentDataEncryptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -2578,25 +2409,6 @@ public static ManagedInstancePrivateLinkResource GetManagedInstancePrivateLinkRe } #endregion - #region ManagedInstanceResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedInstanceResource GetManagedInstanceResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedInstanceResource.ValidateResourceId(id); - return new ManagedInstanceResource(client, id); - } - ); - } - #endregion - #region ManagedInstanceVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -3148,6 +2960,120 @@ public static OutboundFirewallRuleResource GetOutboundFirewallRuleResource(this } #endregion + #region SqlServerResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SqlServerResource GetSqlServerResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SqlServerResource.ValidateResourceId(id); + return new SqlServerResource(client, id); + } + ); + } + #endregion + + #region SubscriptionLongTermRetentionBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); + return new SubscriptionLongTermRetentionBackupResource(client, id); + } + ); + } + #endregion + + #region ResourceGroupLongTermRetentionBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionBackupResource(client, id); + } + ); + } + #endregion + + #region SubscriptionLongTermRetentionManagedInstanceBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionLongTermRetentionManagedInstanceBackupResource GetSubscriptionLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SubscriptionLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); + return new SubscriptionLongTermRetentionManagedInstanceBackupResource(client, id); + } + ); + } + #endregion + + #region ResourceGroupLongTermRetentionManagedInstanceBackupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGroupLongTermRetentionManagedInstanceBackupResource GetResourceGroupLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ResourceGroupLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionManagedInstanceBackupResource(client, id); + } + ); + } + #endregion + + #region ManagedInstanceResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedInstanceResource GetManagedInstanceResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedInstanceResource.ValidateResourceId(id); + return new ManagedInstanceResource(client, id); + } + ); + } + #endregion + #region RestorableDroppedDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -3186,39 +3112,96 @@ public static RestorableDroppedManagedDatabaseResource GetRestorableDroppedManag } #endregion - #region SqlServerResource + #region ServerConnectionPolicyResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SqlServerResource GetSqlServerResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServerConnectionPolicyResource GetServerConnectionPolicyResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - SqlServerResource.ValidateResourceId(id); - return new SqlServerResource(client, id); + ServerConnectionPolicyResource.ValidateResourceId(id); + return new ServerConnectionPolicyResource(client, id); } ); } #endregion - #region ServerConnectionPolicyResource + #region ReplicationLinkResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ServerConnectionPolicyResource GetServerConnectionPolicyResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ReplicationLinkResource GetReplicationLinkResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ServerConnectionPolicyResource.ValidateResourceId(id); - return new ServerConnectionPolicyResource(client, id); + ReplicationLinkResource.ValidateResourceId(id); + return new ReplicationLinkResource(client, id); + } + ); + } + #endregion + + #region ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource GetManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); + return new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(client, id); + } + ); + } + #endregion + + #region ServerDatabaseSchemaTableColumnSensitivityLabelResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServerDatabaseSchemaTableColumnSensitivityLabelResource GetServerDatabaseSchemaTableColumnSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServerDatabaseSchemaTableColumnSensitivityLabelResource.ValidateResourceId(id); + return new ServerDatabaseSchemaTableColumnSensitivityLabelResource(client, id); + } + ); + } + #endregion + + #region ManagedServerDnsAliasResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedServerDnsAliasResource GetManagedServerDnsAliasResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedServerDnsAliasResource.ValidateResourceId(id); + return new ManagedServerDnsAliasResource(client, id); } ); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 4f8768ca1c845..fc834eda0b0ac 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -27,20 +27,18 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private InstancePoolsRestOperations _instancePoolRestClient; private ClientDiagnostics _capabilitiesClientDiagnostics; private CapabilitiesRestOperations _capabilitiesRestClient; - private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; - private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; - private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; - private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; - private ClientDiagnostics _managedInstanceClientDiagnostics; - private ManagedInstancesRestOperations _managedInstanceRestClient; - private ClientDiagnostics _operationsHealthClientDiagnostics; - private OperationsHealthRestOperations _operationsHealthRestClient; private ClientDiagnostics _syncGroupClientDiagnostics; private SyncGroupsRestOperations _syncGroupRestClient; private ClientDiagnostics _virtualClusterClientDiagnostics; private VirtualClustersRestOperations _virtualClusterRestClient; private ClientDiagnostics _sqlServerServersClientDiagnostics; private ServersRestOperations _sqlServerServersRestClient; + private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; + private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; + private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; + private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; + private ClientDiagnostics _managedInstanceClientDiagnostics; + private ManagedInstancesRestOperations _managedInstanceRestClient; /// Initializes a new instance of the class for mocking. protected SubscriptionResourceExtensionClient() @@ -60,20 +58,18 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); private ClientDiagnostics CapabilitiesClientDiagnostics => _capabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); private CapabilitiesRestOperations CapabilitiesRestClient => _capabilitiesRestClient ??= new CapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); - private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); - private ClientDiagnostics OperationsHealthClientDiagnostics => _operationsHealthClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OperationsHealthRestOperations OperationsHealthRestClient => _operationsHealthRestClient ??= new OperationsHealthRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics SyncGroupClientDiagnostics => _syncGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SyncGroupResource.ResourceType.Namespace, Diagnostics); private SyncGroupsRestOperations SyncGroupRestClient => _syncGroupRestClient ??= new SyncGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SyncGroupResource.ResourceType)); private ClientDiagnostics VirtualClusterClientDiagnostics => _virtualClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", VirtualClusterResource.ResourceType.Namespace, Diagnostics); private VirtualClustersRestOperations VirtualClusterRestClient => _virtualClusterRestClient ??= new VirtualClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualClusterResource.ResourceType)); private ClientDiagnostics SqlServerServersClientDiagnostics => _sqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerResource.ResourceType.Namespace, Diagnostics); private ServersRestOperations SqlServerServersRestClient => _sqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlServerResource.ResourceType)); + private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); + private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -89,6 +85,22 @@ public virtual DeletedServerCollection GetDeletedServers(string locationName) return new DeletedServerCollection(Client, Id, locationName); } + /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. + /// The name of the region where the resource is located. + /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. + public virtual SubscriptionUsageCollection GetSubscriptionUsages(string locationName) + { + return new SubscriptionUsageCollection(Client, Id, locationName); + } + + /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. + /// The String to use. + /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. + public virtual SqlTimeZoneCollection GetSqlTimeZones(string locationName) + { + return new SqlTimeZoneCollection(Client, Id, locationName); + } + /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. /// The location of the database. /// The name of the server. @@ -109,22 +121,6 @@ public virtual SubscriptionLongTermRetentionManagedInstanceBackupCollection GetS return new SubscriptionLongTermRetentionManagedInstanceBackupCollection(Client, Id, locationName, managedInstanceName, databaseName); } - /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. - /// The name of the region where the resource is located. - /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. - public virtual SubscriptionUsageCollection GetSubscriptionUsages(string locationName) - { - return new SubscriptionUsageCollection(Client, Id, locationName); - } - - /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. - /// The String to use. - /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. - public virtual SqlTimeZoneCollection GetSqlTimeZones(string locationName) - { - return new SqlTimeZoneCollection(Client, Id, locationName); - } - /// /// Gets a list of all deleted servers in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers @@ -342,25 +338,23 @@ public virtual Response GetByLocationCapability(string loc } /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the region where the resource is located. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(string locationName, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SyncGroupRestClient.ListSyncDatabaseIdsAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -368,14 +362,14 @@ async Task> FirstPageFunc(int? throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SyncGroupRestClient.ListSyncDatabaseIdsNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -387,25 +381,23 @@ async Task> NextPageFunc(strin } /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation + /// Gets a collection of sync database ids. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// Operation Id: SyncGroups_ListSyncDatabaseIds /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the region where the resource is located. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSyncDatabaseIdsSyncGroups(string locationName, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SyncGroupRestClient.ListSyncDatabaseIds(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -413,14 +405,14 @@ Page FirstPageFunc(int? pageSizeHin throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SyncGroupRestClient.ListSyncDatabaseIdsNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -432,26 +424,22 @@ Page NextPageFunc(string nextLink, } /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualClustersAsync(CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByServerAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await VirtualClusterRestClient.ListAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -459,14 +447,14 @@ async Task> FirstPageFunc(int? throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = await LongTermRetentionBackupsRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await VirtualClusterRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -478,26 +466,22 @@ async Task> NextPageFunc(strin } /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer + /// Gets a list of all virtualClusters in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// Operation Id: VirtualClusters_List /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualClusters(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = VirtualClusterRestClient.List(Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -505,14 +489,14 @@ Page FirstPageFunc(int? pageSizeHin throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); scope.Start(); try { - var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = VirtualClusterRestClient.ListNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -524,26 +508,23 @@ Page NextPageFunc(string nextLink, } /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The child resources to include in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSqlServersAsync(string expand = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceAsync(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SqlServerServersRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -551,14 +532,14 @@ async Task> Fir throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await SqlServerServersRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -570,26 +551,23 @@ async Task> Nex } /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance + /// Gets a list of all servers in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// Operation Id: Servers_List /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The child resources to include in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByInstance(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSqlServers(string expand = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SqlServerServersRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -597,14 +575,14 @@ Page FirstPageFunc(i throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); scope.Start(); try { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = SqlServerServersRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -616,113 +594,71 @@ Page NextPageFunc(st } /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name availability request parameters. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + public virtual async Task> CheckNameAvailabilityServerAsync(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityServer"); + scope.Start(); + try { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, parameters, cancellationToken).ConfigureAwait(false); + return response; } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + catch (Exception e) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + scope.Failed(e); + throw; } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation + /// Determines whether a resource can be created with the specified name. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// Operation Id: Servers_CheckNameAvailability /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name availability request parameters. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + public virtual Response CheckNameAvailabilityServer(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityServer"); + scope.Start(); + try { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var response = SqlServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, parameters, cancellationToken); + return response; } - Page NextPageFunc(string nextLink, int? pageSizeHint) + catch (Exception e) { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + scope.Failed(e); + throw; } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// - /// Gets a list of all managed instances in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// Operation Id: ManagedInstances_List + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation /// - /// The child resources to include in the response. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = await ManagedInstanceRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -730,14 +666,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = await ManagedInstanceRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -749,23 +685,25 @@ async Task> NextPageFunc(string nextLink, int? pag } /// - /// Gets a list of all managed instances in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// Operation Id: ManagedInstances_List + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation /// - /// The child resources to include in the response. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = ManagedInstanceRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -773,14 +711,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); scope.Start(); try { - var response = ManagedInstanceRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -792,23 +730,26 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsHealthsByLocationAsync(string locationName, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = await OperationsHealthRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByServerAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -816,14 +757,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = await OperationsHealthRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionBackupsRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -835,23 +776,26 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi } /// - /// Gets a service operation health status. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth - /// Operation Id: OperationsHealth_ListByLocation + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationsHealthsByLocation(string locationName, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = OperationsHealthRestClient.ListByLocation(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -859,14 +803,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = OperationsHealthClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetOperationsHealthsByLocation"); + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); scope.Start(); try { - var response = OperationsHealthRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -878,23 +822,26 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(string locationName, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = await SyncGroupRestClient.ListSyncDatabaseIdsAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceAsync(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -902,14 +849,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = await SyncGroupRestClient.ListSyncDatabaseIdsNextPageAsync(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -921,23 +868,26 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a collection of sync database ids. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// Operation Id: SyncGroups_ListSyncDatabaseIds + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance /// - /// The name of the region where the resource is located. + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSyncDatabaseIdsSyncGroups(string locationName, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByInstance(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = SyncGroupRestClient.ListSyncDatabaseIds(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -945,14 +895,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SyncGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); scope.Start(); try { - var response = SyncGroupRestClient.ListSyncDatabaseIdsNextPage(nextLink, Id.SubscriptionId, locationName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -964,22 +914,25 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualClustersAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = await VirtualClusterRestClient.ListAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -987,14 +940,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = await VirtualClusterRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1006,22 +959,25 @@ async Task> NextPageFunc(string nextLink, int? page } /// - /// Gets a list of all virtualClusters in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// Operation Id: VirtualClusters_List + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualClusters(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = VirtualClusterRestClient.List(Id.SubscriptionId, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1029,14 +985,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = VirtualClusterClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualClusters"); + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); scope.Start(); try { - var response = VirtualClusterRestClient.ListNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new VirtualClusterResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1048,23 +1004,23 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List + /// Gets a list of all managed instances in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// Operation Id: ManagedInstances_List /// /// The child resources to include in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSqlServersAsync(string expand = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = await SqlServerServersRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await ManagedInstanceRestClient.ListAsync(Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1072,14 +1028,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = await SqlServerServersRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await ManagedInstanceRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1091,23 +1047,23 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH } /// - /// Gets a list of all servers in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// Operation Id: Servers_List + /// Gets a list of all managed instances in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// Operation Id: ManagedInstances_List /// /// The child resources to include in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSqlServers(string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = SqlServerServersRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = ManagedInstanceRestClient.List(Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1115,14 +1071,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSqlServers"); + using var scope = ManagedInstanceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedInstances"); scope.Start(); try { - var response = SqlServerServersRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SqlServerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = ManagedInstanceRestClient.ListNextPage(nextLink, Id.SubscriptionId, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1132,51 +1088,5 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - - /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability - /// - /// The name availability request parameters. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilityServerAsync(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) - { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityServer"); - scope.Start(); - try - { - var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, parameters, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Determines whether a resource can be created with the specified name. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// Operation Id: Servers_CheckNameAvailability - /// - /// The name availability request parameters. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilityServer(CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default) - { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.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/InstancePoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs index 1f0b2d8297c4f..ade1f032b6a55 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs @@ -37,10 +37,10 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _instancePoolClientDiagnostics; private readonly InstancePoolsRestOperations _instancePoolRestClient; - private readonly ClientDiagnostics _managedInstanceClientDiagnostics; - private readonly ManagedInstancesRestOperations _managedInstanceRestClient; private readonly ClientDiagnostics _usagesClientDiagnostics; private readonly UsagesRestOperations _usagesRestClient; + private readonly ClientDiagnostics _managedInstanceClientDiagnostics; + private readonly ManagedInstancesRestOperations _managedInstanceRestClient; private readonly InstancePoolData _data; /// Initializes a new instance of the class for mocking. @@ -65,11 +65,11 @@ internal InstancePoolResource(ArmClient client, ResourceIdentifier id) : base(cl _instancePoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string instancePoolApiVersion); _instancePoolRestClient = new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, instancePoolApiVersion); + _usagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _usagesRestClient = new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _managedInstanceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(ManagedInstanceResource.ResourceType, out string managedInstanceApiVersion); _managedInstanceRestClient = new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedInstanceApiVersion); - _usagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _usagesRestClient = new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -200,23 +200,23 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Gets a list of all managed instances in an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances - /// Operation Id: ManagedInstances_ListByInstancePool + /// Gets all instance pool usage metrics + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages + /// Operation Id: Usages_ListByInstancePool /// - /// The child resources to include in the response. + /// Optional request parameter to include managed instance usages within the instance pool. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(bool? expandChildren = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = await _managedInstanceRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _usagesRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -224,14 +224,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = await _managedInstanceRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _usagesRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -243,23 +243,23 @@ async Task> NextPageFunc(string nextLink, int? pag } /// - /// Gets a list of all managed instances in an instance pool. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances - /// Operation Id: ManagedInstances_ListByInstancePool + /// Gets all instance pool usage metrics + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages + /// Operation Id: Usages_ListByInstancePool /// - /// The child resources to include in the response. + /// Optional request parameter to include managed instance usages within the instance pool. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(bool? expandChildren = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = _managedInstanceRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _usagesRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -267,14 +267,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); + using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); scope.Start(); try { - var response = _managedInstanceRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _usagesRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -286,23 +286,23 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets all instance pool usage metrics - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages - /// Operation Id: Usages_ListByInstancePool + /// Gets a list of all managed instances in an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances + /// Operation Id: ManagedInstances_ListByInstancePool /// - /// Optional request parameter to include managed instance usages within the instance pool. + /// The child resources to include in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(bool? expandChildren = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = await _usagesRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _managedInstanceRestClient.ListByInstancePoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -310,14 +310,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = await _usagesRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _managedInstanceRestClient.ListByInstancePoolNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -329,23 +329,23 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH } /// - /// Gets all instance pool usage metrics - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages - /// Operation Id: Usages_ListByInstancePool + /// Gets a list of all managed instances in an instance pool. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances + /// Operation Id: ManagedInstances_ListByInstancePool /// - /// Optional request parameter to include managed instance usages within the instance pool. + /// The child resources to include in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(bool? expandChildren = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = _usagesRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _managedInstanceRestClient.ListByInstancePool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -353,14 +353,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _usagesClientDiagnostics.CreateScope("InstancePoolResource.GetUsages"); + using var scope = _managedInstanceClientDiagnostics.CreateScope("InstancePoolResource.GetManagedInstances"); scope.Start(); try { - var response = _usagesRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expandChildren, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _managedInstanceRestClient.ListByInstancePoolNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedServerDnsAliasOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedServerDnsAliasOperationSource.cs new file mode 100644 index 0000000000000..1584715c6788b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedServerDnsAliasOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + internal class ManagedServerDnsAliasOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ManagedServerDnsAliasOperationSource(ArmClient client) + { + _client = client; + } + + ManagedServerDnsAliasResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return new ManagedServerDnsAliasResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return new ManagedServerDnsAliasResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ReplicationLinkOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ReplicationLinkOperationSource.cs new file mode 100644 index 0000000000000..329679fcee155 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ReplicationLinkOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + internal class ReplicationLinkOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ReplicationLinkOperationSource(ArmClient client) + { + _client = client; + } + + ReplicationLinkResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ReplicationLinkData.DeserializeReplicationLinkData(document.RootElement); + return new ReplicationLinkResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ReplicationLinkData.DeserializeReplicationLinkData(document.RootElement); + return new ReplicationLinkResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs index 5507cd8cad8da..a49490b2d0cb9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs @@ -1186,6 +1186,92 @@ public virtual Response UpdateRecommendedManagedDatabaseSensitivityLabel(Recomme } } + /// + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: ManagedDatabaseSensitivityLabels_ListByDatabase + /// + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedDatabaseSensitivityLabelsByDatabaseAsync(string filter = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = await _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = await _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: ManagedDatabaseSensitivityLabels_ListByDatabase + /// + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedDatabaseSensitivityLabelsByDatabase(string filter = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + /// /// Add a tag to the current resource. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs index 4ab5f289a8144..b3059a6698dfd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs @@ -67,12 +67,14 @@ public ManagedInstanceData(AzureLocation location) : base(location) /// Specifies maintenance configuration id to apply to this managed instance. /// List of private endpoint connections on a managed instance. /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. - /// The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). /// Whether or not the multi-az is enabled. /// The resource id of a user assigned identity to be used by default. /// A CMK URI of the key to use for encryption. /// The Azure Active Directory administrator of the server. - internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, SqlSku sku, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, string subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, string dnsZonePartner, bool? publicDataEndpointEnabled, string sourceManagedInstanceId, DateTimeOffset? restorePointInOn, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, string instancePoolId, string maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, StorageAccountType? storageAccountType, bool? zoneRedundant, string primaryUserAssignedIdentityId, string keyId, ManagedInstanceExternalAdministrator administrators) : base(id, name, resourceType, systemData, tags, location) + /// The managed instance's service principal. + internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, SqlSku sku, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, string subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, string dnsZonePartner, bool? publicDataEndpointEnabled, string sourceManagedInstanceId, DateTimeOffset? restorePointInOn, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, string instancePoolId, string maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, BackupStorageRedundancy? currentBackupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy, bool? zoneRedundant, string primaryUserAssignedIdentityId, string keyId, ManagedInstanceExternalAdministrator administrators, ServicePrincipal servicePrincipal) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; Sku = sku; @@ -98,11 +100,13 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType re MaintenanceConfigurationId = maintenanceConfigurationId; PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; - StorageAccountType = storageAccountType; + CurrentBackupStorageRedundancy = currentBackupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; ZoneRedundant = zoneRedundant; PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; KeyId = keyId; Administrators = administrators; + ServicePrincipal = servicePrincipal; } /// The Azure Active Directory identity of the managed instance. @@ -166,8 +170,10 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType re public IReadOnlyList PrivateEndpointConnections { get; } /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } - /// The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). - public StorageAccountType? StorageAccountType { get; set; } + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Whether or not the multi-az is enabled. public bool? ZoneRedundant { get; set; } /// The resource id of a user assigned identity to be used by default. @@ -176,5 +182,7 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType re public string KeyId { get; set; } /// The Azure Active Directory administrator of the server. public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// The managed instance's service principal. + public ServicePrincipal ServicePrincipal { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs index 53709dc5ed893..b8e302dd45e3e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs @@ -531,6 +531,43 @@ public virtual Response GetRestorableD return GetRestorableDroppedManagedDatabases().Get(restorableDroppedDatabaseId, cancellationToken); } + /// Gets a collection of ManagedServerDnsAliasResources in the ManagedInstance. + /// An object representing collection of ManagedServerDnsAliasResources and their operations over a ManagedServerDnsAliasResource. + public virtual ManagedServerDnsAliasCollection GetManagedServerDnsAliases() + { + return GetCachedClient(Client => new ManagedServerDnsAliasCollection(Client, Id)); + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetManagedServerDnsAliasAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + return await GetManagedServerDnsAliases().GetAsync(dnsAliasName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetManagedServerDnsAlias(string dnsAliasName, CancellationToken cancellationToken = default) + { + return GetManagedServerDnsAliases().Get(dnsAliasName, cancellationToken); + } + /// /// Gets a managed instance. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} @@ -777,6 +814,150 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } + /// + /// Creates a TDE certificate for a given server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + /// Operation Id: ManagedInstanceTdeCertificates_Create + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The requested TDE certificate to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual async Task CreateManagedInstanceTdeCertificateAsync(WaitUntil waitUntil, TdeCertificate parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); + scope.Start(); + try + { + var response = await _managedInstanceTdeCertificatesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a TDE certificate for a given server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + /// Operation Id: ManagedInstanceTdeCertificates_Create + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The requested TDE certificate to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateManagedInstanceTdeCertificate(WaitUntil waitUntil, TdeCertificate parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); + scope.Start(); + try + { + var response = _managedInstanceTdeCertificatesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken); + var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server trust groups by instance name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups + /// Operation Id: ServerTrustGroups_ListByInstance + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetServerTrustGroupsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = await _serverTrustGroupRestClient.ListByInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = await _serverTrustGroupRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a server trust groups by instance name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups + /// Operation Id: ServerTrustGroups_ListByInstance + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetServerTrustGroups(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = _serverTrustGroupRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); + scope.Start(); + try + { + var response = _serverTrustGroupRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + /// /// Get top resource consuming queries of a managed instance. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries @@ -929,150 +1110,6 @@ public virtual ArmOperation Failover(WaitUntil waitUntil, ReplicaType? replicaTy } } - /// - /// Creates a TDE certificate for a given server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates - /// Operation Id: ManagedInstanceTdeCertificates_Create - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The requested TDE certificate to be created or updated. - /// The cancellation token to use. - /// is null. - public virtual async Task CreateManagedInstanceTdeCertificateAsync(WaitUntil waitUntil, TdeCertificate parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); - scope.Start(); - try - { - var response = await _managedInstanceTdeCertificatesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates a TDE certificate for a given server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates - /// Operation Id: ManagedInstanceTdeCertificates_Create - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The requested TDE certificate to be created or updated. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation CreateManagedInstanceTdeCertificate(WaitUntil waitUntil, TdeCertificate parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _managedInstanceTdeCertificatesClientDiagnostics.CreateScope("ManagedInstanceResource.CreateManagedInstanceTdeCertificate"); - scope.Start(); - try - { - var response = _managedInstanceTdeCertificatesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken); - var operation = new SqlArmOperation(_managedInstanceTdeCertificatesClientDiagnostics, Pipeline, _managedInstanceTdeCertificatesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a server trust groups by instance name. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups - /// Operation Id: ServerTrustGroups_ListByInstance - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetServerTrustGroupsAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = await _serverTrustGroupRestClient.ListByInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = await _serverTrustGroupRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Gets a server trust groups by instance name. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustGroups - /// Operation Id: ServerTrustGroups_ListByInstance - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetServerTrustGroups(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = _serverTrustGroupRestClient.ListByInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ManagedInstanceResource.GetServerTrustGroups"); - scope.Start(); - try - { - var response = _serverTrustGroupRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerTrustGroupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - /// /// Add a tag to the current resource. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs new file mode 100644 index 0000000000000..b47ab39a23052 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs @@ -0,0 +1,334 @@ +// 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; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetManagedServerDnsAliases method from an instance of . + /// + public partial class ManagedServerDnsAliasCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedServerDnsAliasClientDiagnostics; + private readonly ManagedServerDnsAliasesRestOperations _managedServerDnsAliasRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedServerDnsAliasCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ManagedServerDnsAliasCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedServerDnsAliasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedServerDnsAliasResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedServerDnsAliasResource.ResourceType, out string managedServerDnsAliasApiVersion); + _managedServerDnsAliasRestClient = new ManagedServerDnsAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedServerDnsAliasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstanceResource.ResourceType), nameof(id)); + } + + /// + /// Creates a managed server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a managed server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content, cancellationToken); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Get"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Get"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases + /// Operation Id: ManagedServerDnsAliases_ListByManagedInstance + /// + /// 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 = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.ListByManagedInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.ListByManagedInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases + /// Operation Id: ManagedServerDnsAliases_ListByManagedInstance + /// + /// 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 = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.ListByManagedInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.ListByManagedInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Exists"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Exists"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasData.cs new file mode 100644 index 0000000000000..c3310c9b69640 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasData.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing the ManagedServerDnsAlias data model. + public partial class ManagedServerDnsAliasData : ResourceData + { + /// Initializes a new instance of ManagedServerDnsAliasData. + public ManagedServerDnsAliasData() + { + } + + /// Initializes a new instance of ManagedServerDnsAliasData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The fully qualified DNS record for managed server alias. + internal ManagedServerDnsAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string azureDnsRecord) : base(id, name, resourceType, systemData) + { + AzureDnsRecord = azureDnsRecord; + } + + /// The fully qualified DNS record for managed server alias. + public string AzureDnsRecord { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs new file mode 100644 index 0000000000000..62c07bec4db96 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing a ManagedServerDnsAlias along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetManagedServerDnsAliasResource method. + /// Otherwise you can get one from its parent resource using the GetManagedServerDnsAlias method. + /// + public partial class ManagedServerDnsAliasResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedServerDnsAliasClientDiagnostics; + private readonly ManagedServerDnsAliasesRestOperations _managedServerDnsAliasRestClient; + private readonly ManagedServerDnsAliasData _data; + + /// Initializes a new instance of the class for mocking. + protected ManagedServerDnsAliasResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedServerDnsAliasResource(ArmClient client, ManagedServerDnsAliasData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ManagedServerDnsAliasResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedServerDnsAliasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedServerDnsAliasApiVersion); + _managedServerDnsAliasRestClient = new ManagedServerDnsAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedServerDnsAliasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/managedInstances/dnsAliases"; + + /// 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 ManagedServerDnsAliasData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Get"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Get"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Delete"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Delete"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(_managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire + /// Operation Id: ManagedServerDnsAliases_Acquire + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> AcquireAsync(WaitUntil waitUntil, ManagedServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Acquire"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.AcquireAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateAcquireRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire + /// Operation Id: ManagedServerDnsAliases_Acquire + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Acquire(WaitUntil waitUntil, ManagedServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Acquire"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Acquire(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateAcquireRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs index f91e87ee069b2..128880e8eb892 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 ee8fb95556237..ebef9f837b63c 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 a4bb6a17adda0..0000000000000 --- 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 0000000000000..35a8a6f158dd6 --- /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(IdentityType)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(IdentityType.Value.ToString()); + } + if (Optional.IsCollectionDefined(UserAssignedIdentities)) + { + writer.WritePropertyName("userAssignedIdentities"); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + 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 0000000000000..e410510af5916 --- /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? identityType, Guid? tenantId, IDictionary userAssignedIdentities, IDictionary delegatedResources) + { + IdentityType = identityType; + TenantId = tenantId; + UserAssignedIdentities = userAssignedIdentities; + DelegatedResources = delegatedResources; + } + + /// The identity type. + public DatabaseIdentityType? IdentityType { get; set; } + /// The Azure Active Directory tenant id. + public Guid? TenantId { get; } + /// The resource ids of the user assigned identities to use. + public IDictionary UserAssignedIdentities { get; } + /// 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 0000000000000..263a17f7b7228 --- /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 0f2a12829f4c1..6080fa5ff97df 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/Delegation.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs new file mode 100644 index 0000000000000..fbf22ed21450d --- /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 0000000000000..f70659e503036 --- /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/ManagedInstanceData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceData.Serialization.cs index 1b33bc6fcde72..01a626228bf3b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceData.Serialization.cs @@ -127,10 +127,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"); writer.WriteStringValue(MinimalTlsVersion); } - if (Optional.IsDefined(StorageAccountType)) + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) { - writer.WritePropertyName("storageAccountType"); - writer.WriteStringValue(StorageAccountType.Value.ToString()); + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); } if (Optional.IsDefined(ZoneRedundant)) { @@ -152,6 +152,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("administrators"); writer.WriteObjectValue(Administrators); } + if (Optional.IsDefined(ServicePrincipal)) + { + writer.WritePropertyName("servicePrincipal"); + writer.WriteObjectValue(ServicePrincipal); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -188,11 +193,13 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e Optional maintenanceConfigurationId = default; Optional> privateEndpointConnections = default; Optional minimalTlsVersion = default; - Optional storageAccountType = default; + Optional currentBackupStorageRedundancy = default; + Optional requestedBackupStorageRedundancy = default; Optional zoneRedundant = default; Optional primaryUserAssignedIdentityId = default; Optional keyId = default; Optional administrators = default; + Optional servicePrincipal = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity")) @@ -420,14 +427,24 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e minimalTlsVersion = property0.Value.GetString(); continue; } - if (property0.NameEquals("storageAccountType")) + if (property0.NameEquals("currentBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + currentBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("requestedBackupStorageRedundancy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - storageAccountType = new StorageAccountType(property0.Value.GetString()); + requestedBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); continue; } if (property0.NameEquals("zoneRedundant")) @@ -460,11 +477,21 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e administrators = ManagedInstanceExternalAdministrator.DeserializeManagedInstanceExternalAdministrator(property0.Value); continue; } + if (property0.NameEquals("servicePrincipal")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + servicePrincipal = ServicePrincipal.DeserializeServicePrincipal(property0.Value); + continue; + } } continue; } } - return new ManagedInstanceData(id, name, type, systemData, tags, location, identity, sku.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(managedInstanceCreateMode), fullyQualifiedDomainName.Value, administratorLogin.Value, administratorLoginPassword.Value, subnetId.Value, state.Value, Optional.ToNullable(licenseType), Optional.ToNullable(vCores), Optional.ToNullable(storageSizeInGB), collation.Value, dnsZone.Value, dnsZonePartner.Value, Optional.ToNullable(publicDataEndpointEnabled), sourceManagedInstanceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(proxyOverride), timezoneId.Value, instancePoolId.Value, maintenanceConfigurationId.Value, Optional.ToList(privateEndpointConnections), minimalTlsVersion.Value, Optional.ToNullable(storageAccountType), Optional.ToNullable(zoneRedundant), primaryUserAssignedIdentityId.Value, keyId.Value, administrators.Value); + return new ManagedInstanceData(id, name, type, systemData, tags, location, identity, sku.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(managedInstanceCreateMode), fullyQualifiedDomainName.Value, administratorLogin.Value, administratorLoginPassword.Value, subnetId.Value, state.Value, Optional.ToNullable(licenseType), Optional.ToNullable(vCores), Optional.ToNullable(storageSizeInGB), collation.Value, dnsZone.Value, dnsZonePartner.Value, Optional.ToNullable(publicDataEndpointEnabled), sourceManagedInstanceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(proxyOverride), timezoneId.Value, instancePoolId.Value, maintenanceConfigurationId.Value, Optional.ToList(privateEndpointConnections), minimalTlsVersion.Value, Optional.ToNullable(currentBackupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(zoneRedundant), primaryUserAssignedIdentityId.Value, keyId.Value, administrators.Value, servicePrincipal.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs index 6eb545e83d0b3..8d43eced2140c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs @@ -125,10 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"); writer.WriteStringValue(MinimalTlsVersion); } - if (Optional.IsDefined(StorageAccountType)) + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) { - writer.WritePropertyName("storageAccountType"); - writer.WriteStringValue(StorageAccountType.Value.ToString()); + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); } if (Optional.IsDefined(ZoneRedundant)) { @@ -150,6 +150,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("administrators"); writer.WriteObjectValue(Administrators); } + if (Optional.IsDefined(ServicePrincipal)) + { + writer.WritePropertyName("servicePrincipal"); + writer.WriteObjectValue(ServicePrincipal); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs index 2773deb6818ea..5e4658f89717d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs @@ -85,8 +85,10 @@ public ManagedInstancePatch() public IReadOnlyList PrivateEndpointConnections { get; } /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } - /// The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). - public StorageAccountType? StorageAccountType { get; set; } + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Whether or not the multi-az is enabled. public bool? ZoneRedundant { get; set; } /// The resource id of a user assigned identity to be used by default. @@ -95,5 +97,7 @@ public ManagedInstancePatch() public string KeyId { get; set; } /// The Azure Active Directory administrator of the server. public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// The managed instance's service principal. + public ServicePrincipal ServicePrincipal { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs index 309aee81a204e..4e611e1942787 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/ManagedServerDnsAliasAcquisition.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.Serialization.cs new file mode 100644 index 0000000000000..f6f504c743017 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.Serialization.cs @@ -0,0 +1,23 @@ +// 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 ManagedServerDnsAliasAcquisition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("oldManagedServerDnsAliasResourceId"); + writer.WriteStringValue(OldManagedServerDnsAliasResourceId); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs new file mode 100644 index 0000000000000..ee2523711b52a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A managed server DNS alias acquisition request. + public partial class ManagedServerDnsAliasAcquisition + { + /// Initializes a new instance of ManagedServerDnsAliasAcquisition. + /// The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead. + /// is null. + public ManagedServerDnsAliasAcquisition(string oldManagedServerDnsAliasResourceId) + { + if (oldManagedServerDnsAliasResourceId == null) + { + throw new ArgumentNullException(nameof(oldManagedServerDnsAliasResourceId)); + } + + OldManagedServerDnsAliasResourceId = oldManagedServerDnsAliasResourceId; + } + + /// The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead. + public string OldManagedServerDnsAliasResourceId { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UnlinkOptions.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.Serialization.cs similarity index 61% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UnlinkOptions.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.Serialization.cs index 4efcc97ebca2a..93fe57797c41e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UnlinkOptions.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.Serialization.cs @@ -10,15 +10,15 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class UnlinkOptions : IUtf8JsonSerializable + public partial class ManagedServerDnsAliasCreateOrUpdateContent : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(ForcedTermination)) + if (Optional.IsDefined(CreateDnsRecord)) { - writer.WritePropertyName("forcedTermination"); - writer.WriteBooleanValue(ForcedTermination.Value); + writer.WritePropertyName("createDnsRecord"); + writer.WriteBooleanValue(CreateDnsRecord.Value); } writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.cs new file mode 100644 index 0000000000000..1494a74369894 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A managed server dns alias creation request. + public partial class ManagedServerDnsAliasCreateOrUpdateContent + { + /// Initializes a new instance of ManagedServerDnsAliasCreateOrUpdateContent. + public ManagedServerDnsAliasCreateOrUpdateContent() + { + } + + /// Whether or not DNS record should be created for this alias. + public bool? CreateDnsRecord { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasData.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/ManagedServerDnsAliasData.Serialization.cs index 4e98b638b99c0..df154d3b3851c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasData.Serialization.cs @@ -9,9 +9,9 @@ using Azure.Core; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Sql.Models +namespace Azure.ResourceManager.Sql { - public partial class OperationsHealth : IUtf8JsonSerializable + public partial class ManagedServerDnsAliasData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -22,15 +22,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OperationsHealth DeserializeOperationsHealth(JsonElement element) + internal static ManagedServerDnsAliasData DeserializeManagedServerDnsAliasData(JsonElement element) { ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - Optional name0 = default; - Optional health = default; - Optional description = default; + Optional azureDnsRecord = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -62,26 +60,16 @@ internal static OperationsHealth DeserializeOperationsHealth(JsonElement element } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("name")) + if (property0.NameEquals("azureDnsRecord")) { - name0 = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("health")) - { - health = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description")) - { - description = property0.Value.GetString(); + azureDnsRecord = property0.Value.GetString(); continue; } } continue; } } - return new OperationsHealth(id, name, type, systemData, name0.Value, health.Value, description.Value); + return new ManagedServerDnsAliasData(id, name, type, systemData, azureDnsRecord.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.Serialization.cs similarity index 64% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.Serialization.cs index e3c818cd1a176..50262c1084d87 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.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 ManagedServerDnsAliasListResult { - internal static OperationsHealthListResult DeserializeOperationsHealthListResult(JsonElement element) + internal static ManagedServerDnsAliasListResult DeserializeManagedServerDnsAliasListResult(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(ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(item)); } value = array; continue; @@ -40,7 +41,7 @@ internal static OperationsHealthListResult DeserializeOperationsHealthListResult continue; } } - return new OperationsHealthListResult(Optional.ToList(value), nextLink.Value); + return new ManagedServerDnsAliasListResult(Optional.ToList(value), nextLink.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.cs new file mode 100644 index 0000000000000..82e6c13c2fb97 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.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 managed server DNS aliases. + internal partial class ManagedServerDnsAliasListResult + { + /// Initializes a new instance of ManagedServerDnsAliasListResult. + internal ManagedServerDnsAliasListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedServerDnsAliasListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedServerDnsAliasListResult(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/OperationsHealth.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.cs deleted file mode 100644 index 60f70e5957975..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealth.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Operations health status in a location. - public partial class OperationsHealth : ResourceData - { - /// Initializes a new instance of OperationsHealth. - public OperationsHealth() - { - } - - /// Initializes a new instance of OperationsHealth. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Operation name for the service. - /// Operation health status of the service. - /// Health status description. - internal OperationsHealth(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string namePropertiesName, string health, string description) : base(id, name, resourceType, systemData) - { - NamePropertiesName = namePropertiesName; - Health = health; - Description = description; - } - - /// Operation name for the service. - public string NamePropertiesName { get; } - /// Operation health status of the service. - public string Health { get; } - /// Health status description. - public string Description { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.cs deleted file mode 100644 index 5c2dd6138dcdd..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationsHealthListResult.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - /// A list of service health statuses in a location. - internal partial class OperationsHealthListResult - { - /// Initializes a new instance of OperationsHealthListResult. - internal OperationsHealthListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of OperationsHealthListResult. - /// Array of results. - /// Link to retrieve next page of results. - internal OperationsHealthListResult(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/RequestedBackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs deleted file mode 100644 index c607d93cbc8d2..0000000000000 --- 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 10f82db57e749..acee7a6e17237 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 58e9e1443239a..0000000000000 --- 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/ServicePrincipal.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs new file mode 100644 index 0000000000000..d18a682146524 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ServicePrincipal : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ServicePrincipal DeserializeServicePrincipal(JsonElement element) + { + Optional principalId = default; + Optional clientId = default; + Optional tenantId = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId")) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new ServicePrincipalType(property.Value.GetString()); + continue; + } + } + return new ServicePrincipal(principalId.Value, clientId.Value, tenantId.Value, Optional.ToNullable(type)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs new file mode 100644 index 0000000000000..f86e34dd10a47 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The managed instance's service principal configuration for a resource. + public partial class ServicePrincipal + { + /// Initializes a new instance of ServicePrincipal. + public ServicePrincipal() + { + } + + /// Initializes a new instance of ServicePrincipal. + /// The Azure Active Directory application object id. + /// The Azure Active Directory application client id. + /// The Azure Active Directory tenant id. + /// Service principal type. + internal ServicePrincipal(string principalId, string clientId, string tenantId, ServicePrincipalType? principalType) + { + PrincipalId = principalId; + ClientId = clientId; + TenantId = tenantId; + PrincipalType = principalType; + } + + /// The Azure Active Directory application object id. + public string PrincipalId { get; } + /// The Azure Active Directory application client id. + public string ClientId { get; } + /// The Azure Active Directory tenant id. + public string TenantId { get; } + /// Service principal type. + public ServicePrincipalType? PrincipalType { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs new file mode 100644 index 0000000000000..e1ddae4780650 --- /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 511d5c2811561..64ee14f2005cf 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/SqlDatabasePatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.Serialization.cs index f2ca1ae44cd86..385e785063e4b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.Serialization.cs @@ -20,6 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"); @@ -148,6 +153,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/SqlDatabasePatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.cs index c405309e1ecb8..542c49390e84e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlDatabasePatch.cs @@ -22,6 +22,8 @@ public SqlDatabasePatch() /// The name and tier of the SKU. public SqlSku Sku { get; set; } + /// Database identity. + public DatabaseIdentity Identity { get; set; } /// Resource tags. public IDictionary Tags { get; } /// @@ -101,9 +103,9 @@ public SqlDatabasePatch() /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. public int? AutoPauseDelay { get; set; } /// The storage account type used to store backups for this database. - public CurrentBackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } /// The storage account type to be used to store backups for this database. - public RequestedBackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Minimal capacity that database will always have allocated, if not paused. public double? MinCapacity { get; set; } /// The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. @@ -116,5 +118,9 @@ public SqlDatabasePatch() public bool? IsLedgerOn { get; set; } /// Infra encryption is enabled for this database. public bool? IsInfraEncryptionEnabled { get; } + /// The Client id used for cross tenant per database CMK scenario. + public Guid? FederatedClientId { get; set; } + /// 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/StorageAccountType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageAccountType.cs deleted file mode 100644 index 3228d0238f9ff..0000000000000 --- 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 6dd57e682089c..0000000000000 --- 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/UnlinkOptions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UnlinkOptions.cs deleted file mode 100644 index 9f06807108584..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UnlinkOptions.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents the parameters for Unlink Replication Link request. - public partial class UnlinkOptions - { - /// Initializes a new instance of UnlinkOptions. - public UnlinkOptions() - { - } - - /// Determines whether link will be terminated in a forced or a friendly way. - public bool? ForcedTermination { get; set; } - } -} 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 6acad900ebfe7..06593a8d50931 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/ReplicationLinkResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinkResource.cs index 376a8780d5dc3..7cb2b47223428 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinkResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinkResource.cs @@ -13,7 +13,6 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; -using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql { @@ -136,7 +135,7 @@ public virtual Response Get(CancellationToken cancellat } /// - /// Deletes a database replication link. Cannot be done during failover. + /// Deletes the replication link. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} /// Operation Id: ReplicationLinks_Delete /// @@ -162,7 +161,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes a database replication link. Cannot be done during failover. + /// Deletes the replication link. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} /// Operation Id: ReplicationLinks_Delete /// @@ -188,22 +187,22 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Sets which replica database is primary by failing over from the current primary replica database. + /// Fails over from the current primary server to this server. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover /// Operation Id: ReplicationLinks_Failover /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task FailoverAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task> FailoverAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _replicationLinkClientDiagnostics.CreateScope("ReplicationLinkResource.Failover"); scope.Start(); try { var response = await _replicationLinkRestClient.FailoverAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ReplicationLinkOperationSource(Client), _replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -214,22 +213,22 @@ public virtual async Task FailoverAsync(WaitUntil waitUntil, Cance } /// - /// Sets which replica database is primary by failing over from the current primary replica database. + /// Fails over from the current primary server to this server. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover /// Operation Id: ReplicationLinks_Failover /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation Failover(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Failover(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _replicationLinkClientDiagnostics.CreateScope("ReplicationLinkResource.Failover"); scope.Start(); try { var response = _replicationLinkRestClient.Failover(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new SqlArmOperation(_replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ReplicationLinkOperationSource(Client), _replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) @@ -240,22 +239,22 @@ public virtual ArmOperation Failover(WaitUntil waitUntil, CancellationToken canc } /// - /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + /// Fails over from the current primary server to this server allowing data loss. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss /// Operation Id: ReplicationLinks_FailoverAllowDataLoss /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task FailoverAllowDataLossAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task> FailoverAllowDataLossAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _replicationLinkClientDiagnostics.CreateScope("ReplicationLinkResource.FailoverAllowDataLoss"); scope.Start(); try { var response = await _replicationLinkRestClient.FailoverAllowDataLossAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverAllowDataLossRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ReplicationLinkOperationSource(Client), _replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverAllowDataLossRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -266,82 +265,22 @@ public virtual async Task FailoverAllowDataLossAsync(WaitUntil wai } /// - /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + /// Fails over from the current primary server to this server allowing data loss. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss /// Operation Id: ReplicationLinks_FailoverAllowDataLoss /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation FailoverAllowDataLoss(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation FailoverAllowDataLoss(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _replicationLinkClientDiagnostics.CreateScope("ReplicationLinkResource.FailoverAllowDataLoss"); scope.Start(); try { var response = _replicationLinkRestClient.FailoverAllowDataLoss(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new SqlArmOperation(_replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverAllowDataLossRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a database replication link in forced or friendly way. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink - /// Operation Id: ReplicationLinks_Unlink - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The required parameters for unlinking replication link. - /// The cancellation token to use. - /// is null. - public virtual async Task UnlinkAsync(WaitUntil waitUntil, UnlinkOptions options, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(options, nameof(options)); - - using var scope = _replicationLinkClientDiagnostics.CreateScope("ReplicationLinkResource.Unlink"); - scope.Start(); - try - { - var response = await _replicationLinkRestClient.UnlinkAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateUnlinkRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a database replication link in forced or friendly way. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink - /// Operation Id: ReplicationLinks_Unlink - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The required parameters for unlinking replication link. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Unlink(WaitUntil waitUntil, UnlinkOptions options, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(options, nameof(options)); - - using var scope = _replicationLinkClientDiagnostics.CreateScope("ReplicationLinkResource.Unlink"); - scope.Start(); - try - { - var response = _replicationLinkRestClient.Unlink(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options, cancellationToken); - var operation = new SqlArmOperation(_replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateUnlinkRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ReplicationLinkOperationSource(Client), _replicationLinkClientDiagnostics, Pipeline, _replicationLinkRestClient.CreateFailoverAllowDataLossRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) 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 6f7a1461226f0..9f67316848d1a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs @@ -33,7 +33,7 @@ public LongTermRetentionBackupsRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs index 2dcead733aebb..7086042a328a9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionManagedInstanceBackupsRestOperations.cs @@ -33,7 +33,7 @@ public LongTermRetentionManagedInstanceBackupsRestOperations(HttpPipeline pipeli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs index 074868a86bd20..19406a50211db 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs @@ -33,10 +33,380 @@ public ManagedDatabaseSensitivityLabelsRestOperations(HttpPipeline pipeline, str { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal HttpMessage CreateListCurrentRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) + { + 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("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/currentSensitivityLabels", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (count != null) + { + uri.AppendQuery("$count", count.Value, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListCurrentAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListCurrent(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList 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("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/currentSensitivityLabels", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update sensitivity labels of a given database using an operations batch. + /// 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 name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update sensitivity labels of a given database using an operations batch. + /// 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 name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) + { + 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("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (includeDisabledRecommendations != null) + { + uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList 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("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// 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 name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// 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 name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UpdateRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { var message = _pipeline.CreateMessage(); @@ -542,7 +912,7 @@ public Response EnableRecommendation(string subscriptionId, string resourceGroup } } - internal HttpMessage CreateListCurrentRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -557,15 +927,7 @@ internal HttpMessage CreateListCurrentRequest(string subscriptionId, string reso uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/currentSensitivityLabels", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (count != null) - { - uri.AppendQuery("$count", count.Value, true); - } + uri.AppendPath("/sensitivityLabels", false); if (filter != null) { uri.AppendQuery("$filter", filter, true); @@ -582,20 +944,18 @@ internal HttpMessage CreateListCurrentRequest(string subscriptionId, string reso /// 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 name of the database. - /// The String to use. - /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListCurrentAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -616,20 +976,18 @@ public async Task> ListCurrentAsync(string /// 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 name of the database. - /// The String to use. - /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListCurrent(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListByDatabase(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -645,117 +1003,14 @@ public Response ListCurrent(string subscriptionId, s } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList 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("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/currentSensitivityLabels", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update sensitivity labels of a given database using an operations batch. - /// 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 name of the database. - /// The SensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update sensitivity labels of a given database using an operations batch. - /// 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 name of the database. - /// The SensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) + internal HttpMessage CreateListCurrentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) { 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("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/recommendedSensitivityLabels", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (includeDisabledRecommendations != null) - { - uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -763,24 +1018,26 @@ internal HttpMessage CreateListRecommendedRequest(string subscriptionId, string } /// Gets the sensitivity labels of a given database. + /// 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 name of the database. /// The String to use. - /// Specifies whether to include disabled recommendations or not. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListCurrentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -797,24 +1054,26 @@ public async Task> ListRecommendedAsync(str } /// Gets the sensitivity labels of a given database. + /// 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 name of the database. /// The String to use. - /// Specifies whether to include disabled recommendations or not. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListCurrentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -830,89 +1089,7 @@ public Response ListRecommended(string subscriptionI } } - internal HttpMessage CreateUpdateRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList 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("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/recommendedSensitivityLabels", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// 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 name of the database. - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// 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 name of the database. - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListCurrentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) + internal HttpMessage CreateListRecommendedNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -933,12 +1110,12 @@ internal HttpMessage CreateListCurrentNextPageRequest(string nextLink, string su /// The name of the managed instance. /// The name of the database. /// The String to use. - /// The Boolean to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListCurrentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListRecommendedNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -946,7 +1123,7 @@ public async Task> ListCurrentNextPageAsync Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -969,12 +1146,12 @@ public async Task> ListCurrentNextPageAsync /// The name of the managed instance. /// The name of the database. /// The String to use. - /// The Boolean to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListCurrentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListRecommendedNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -982,7 +1159,7 @@ public Response ListCurrentNextPage(string nextLink, Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -998,7 +1175,7 @@ public Response ListCurrentNextPage(string nextLink, } } - internal HttpMessage CreateListRecommendedNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1018,13 +1195,11 @@ internal HttpMessage CreateListRecommendedNextPageRequest(string nextLink, strin /// 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 name of the database. - /// The String to use. - /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListRecommendedNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListByDatabaseNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -1032,7 +1207,7 @@ public async Task> ListRecommendedNextPageA Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1054,13 +1229,11 @@ public async Task> ListRecommendedNextPageA /// 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 name of the database. - /// The String to use. - /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListRecommendedNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListByDatabaseNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -1068,7 +1241,7 @@ public Response ListRecommendedNextPage(string nextL Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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 aa191f0be0bea..6938e21bc0a4f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs @@ -33,7 +33,7 @@ public ManagedInstancesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedServerDnsAliasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedServerDnsAliasesRestOperations.cs new file mode 100644 index 0000000000000..816e922121fa1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedServerDnsAliasesRestOperations.cs @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedServerDnsAliasesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedServerDnsAliasesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ManagedServerDnsAliasesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2021-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByManagedInstanceRequest(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("/dnsAliases", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + 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("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a server DNS alias. + /// 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 String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedServerDnsAliasData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a server DNS alias. + /// 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 String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedServerDnsAliasData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content) + { + 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("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Creates a managed server DNS alias. + /// 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 String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a managed server DNS alias. + /// 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 String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + 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("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Deletes the managed server DNS alias with the given name. + /// 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 String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the managed server DNS alias with the given name. + /// 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 String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateAcquireRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + 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("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendPath("/acquire", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(parameters); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Acquires managed server DNS alias from another managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task AcquireAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var message = CreateAcquireRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Acquires managed server DNS alias from another managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Acquire(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var message = CreateAcquireRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByManagedInstanceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs deleted file mode 100644 index 8b4c4fc088d3b..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/OperationsHealthRestOperations.cs +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - internal partial class OperationsHealthRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of OperationsHealthRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public OperationsHealthRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal HttpMessage CreateListByLocationRequest(string subscriptionId, string locationName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Sql/locations/", false); - uri.AppendPath(locationName, true); - uri.AppendPath("/operationsHealth", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a service operation health status. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByLocationAsync(string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationRequest(subscriptionId, locationName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a service operation health status. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByLocation(string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationRequest(subscriptionId, locationName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string subscriptionId, string locationName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a service operation health status. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByLocationNextPageAsync(string nextLink, string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationNextPageRequest(nextLink, subscriptionId, locationName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a service operation health status. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByLocationNextPage(string nextLink, string subscriptionId, string locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - using var message = CreateListByLocationNextPageRequest(nextLink, subscriptionId, locationName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationsHealthListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OperationsHealthListResult.DeserializeOperationsHealthListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs index 672dfd64b2896..fc713e8bb92b2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs @@ -33,15 +33,15 @@ public ReplicationLinksRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2014-04-01"; + _apiVersion = apiVersion ?? "2021-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -52,77 +52,81 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/replicationLinks/", false); - uri.AppendPath(linkId, true); + uri.AppendPath("/replicationLinks", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Deletes a database replication link. Cannot be done during failover. + /// Gets a list of replication links on database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be dropped. - /// The ID of the replication link to be deleted. + /// The name of the database. /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + ReplicationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Deletes a database replication link. Cannot be done during failover. + /// Gets a list of replication links on database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be dropped. - /// The ID of the replication link to be deleted. + /// The name of the database. /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + ReplicationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateFailoverRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -135,23 +139,23 @@ internal HttpMessage CreateFailoverRequest(string subscriptionId, string resourc uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); - uri.AppendPath("/failover", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Sets which replica database is primary by failing over from the current primary replica database. + /// Gets a replication link. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task FailoverAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -159,28 +163,34 @@ public async Task FailoverAsync(string subscriptionId, string resource Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateFailoverRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + ReplicationLinkData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ReplicationLinkData.DeserializeReplicationLinkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ReplicationLinkData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Sets which replica database is primary by failing over from the current primary replica database. + /// Gets a replication link. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Failover(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -188,23 +198,29 @@ public Response Failover(string subscriptionId, string resourceGroupName, string Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateFailoverRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + ReplicationLinkData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ReplicationLinkData.DeserializeReplicationLinkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ReplicationLinkData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateFailoverAllowDataLossRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -217,23 +233,22 @@ internal HttpMessage CreateFailoverAllowDataLossRequest(string subscriptionId, s uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); - uri.AppendPath("/forceFailoverAllowDataLoss", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; _userAgent.Apply(message); return message; } - /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + /// Deletes the replication link. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. + /// The name of the database. + /// The String to use. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task FailoverAllowDataLossAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -241,28 +256,27 @@ public async Task FailoverAllowDataLossAsync(string subscriptionId, st Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateFailoverAllowDataLossRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 202: - case 204: + case 200: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + /// Deletes the replication link. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. + /// The name of the database. + /// The String to use. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response FailoverAllowDataLoss(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -270,19 +284,18 @@ public Response FailoverAllowDataLoss(string subscriptionId, string resourceGrou Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateFailoverAllowDataLossRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 202: - case 204: + case 200: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateUnlinkRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkOptions options) + internal HttpMessage CreateFailoverRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -299,169 +312,77 @@ internal HttpMessage CreateUnlinkRequest(string subscriptionId, string resourceG uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); - uri.AppendPath("/unlink", false); + uri.AppendPath("/failover", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(options); - request.Content = content; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Deletes a database replication link in forced or friendly way. + /// Fails over from the current primary server to this server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. - /// The required parameters for unlinking replication link. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. - /// , , , , or is null. + /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task UnlinkAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkOptions options, CancellationToken cancellationToken = default) + public async Task FailoverAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - Argument.AssertNotNull(options, nameof(options)); - using var message = CreateUnlinkRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId, options); + using var message = CreateFailoverRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { + case 200: case 202: - case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Deletes a database replication link in forced or friendly way. + /// Fails over from the current primary server to this server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. - /// The required parameters for unlinking replication link. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. - /// , , , , or is null. + /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Unlink(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkOptions options, CancellationToken cancellationToken = default) + public Response Failover(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - Argument.AssertNotNull(options, nameof(options)); - using var message = CreateUnlinkRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId, options); + using var message = CreateFailoverRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { + case 200: case 202: - case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) - { - 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("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/replicationLinks", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a list of replication links on database. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the database. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ReplicationLinkListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of replication links on database. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the database. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ReplicationLinkListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) + internal HttpMessage CreateFailoverAllowDataLossRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -474,6 +395,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); + uri.AppendPath("/forceFailoverAllowDataLoss", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -481,7 +403,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Gets a replication link. + /// Fails over from the current primary server to this server allowing data loss. /// 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. @@ -490,7 +412,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public async Task FailoverAllowDataLossAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -498,25 +420,19 @@ public async Task> GetAsync(string subscriptionId, Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateFailoverAllowDataLossRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ReplicationLinkData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ReplicationLinkData.DeserializeReplicationLinkData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ReplicationLinkData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets a replication link. + /// Fails over from the current primary server to this server allowing data loss. /// 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. @@ -525,7 +441,7 @@ public async Task> GetAsync(string subscriptionId, /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public Response FailoverAllowDataLoss(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -533,19 +449,13 @@ public Response Get(string subscriptionId, string resourceG Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + using var message = CreateFailoverAllowDataLossRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ReplicationLinkData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ReplicationLinkData.DeserializeReplicationLinkData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ReplicationLinkData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs index 169e786237aa0..13e6b7e9d8cc0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableDroppedDatabasesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-02-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs index 0665a5fbef06c..4df153191bc2c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/RestorableDroppedManagedDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableDroppedManagedDatabasesRestOperations(HttpPipeline pipeline, st { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-02-01-preview"; + _apiVersion = apiVersion ?? "2021-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs index c40c4778e4cdb..881ee3a709777 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs @@ -33,7 +33,7 @@ public SensitivityLabelsRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -407,11 +407,11 @@ public Response UpdateRecommended(string subscriptionId, string resourceGroupNam } } - internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -429,15 +429,15 @@ internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, st uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("recommended", true); - uri.AppendPath("/enable", false); + uri.AppendPath(sensitivityLabelSource.ToSerialString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + /// Gets the sensitivity label of a given column. /// 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. @@ -445,10 +445,11 @@ internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, st /// The name of the schema. /// The name of the table. /// The name of the column. + /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task EnableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -458,18 +459,25 @@ public async Task EnableRecommendationAsync(string subscriptionId, str Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + { + SensitivityLabelData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SensitivityLabelData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + /// Gets the sensitivity label of a given column. /// 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. @@ -477,10 +485,11 @@ public async Task EnableRecommendationAsync(string subscriptionId, str /// The name of the schema. /// The name of the table. /// The name of the column. + /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response EnableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -490,22 +499,29 @@ public Response EnableRecommendation(string subscriptionId, string resourceGroup Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + { + SensitivityLabelData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SensitivityLabelData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -523,15 +539,19 @@ internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, s uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("recommended", true); - uri.AppendPath("/disable", false); + uri.AppendPath("current", true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } - /// Disables sensitivity recommendations on a given column. + /// Creates or updates the sensitivity label of a given column. /// 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. @@ -539,10 +559,11 @@ internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, s /// The name of the schema. /// The name of the table. /// The name of the column. + /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , or is null. + /// , , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task DisableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -551,19 +572,26 @@ public async Task DisableRecommendationAsync(string subscriptionId, st Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + case 201: + { + SensitivityLabelData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Disables sensitivity recommendations on a given column. + /// Creates or updates the sensitivity label of a given column. /// 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. @@ -571,10 +599,11 @@ public async Task DisableRecommendationAsync(string subscriptionId, st /// The name of the schema. /// The name of the table. /// The name of the column. + /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , or is null. + /// , , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response DisableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -583,23 +612,30 @@ public Response DisableRecommendation(string subscriptionId, string resourceGrou Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + case 201: + { + SensitivityLabelData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -617,15 +653,14 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath(sensitivityLabelSource.ToSerialString(), true); + uri.AppendPath("current", true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Gets the sensitivity label of a given column. + /// Deletes the sensitivity label of a given column. /// 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. @@ -633,11 +668,10 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The name of the schema. /// The name of the table. /// The name of the column. - /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -647,25 +681,18 @@ public async Task> GetAsync(string subscriptionId Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - SensitivityLabelData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((SensitivityLabelData)null, message.Response); + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets the sensitivity label of a given column. + /// Deletes the sensitivity label of a given column. /// 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. @@ -673,11 +700,10 @@ public async Task> GetAsync(string subscriptionId /// The name of the schema. /// The name of the table. /// The name of the column. - /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -687,29 +713,22 @@ public Response Get(string subscriptionId, string resource Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - SensitivityLabelData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((SensitivityLabelData)null, message.Response); + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data) + internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -727,19 +746,15 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("current", true); + uri.AppendPath("recommended", true); + uri.AppendPath("/disable", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates or updates the sensitivity label of a given column. + /// Disables sensitivity recommendations on a given column. /// 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. @@ -747,11 +762,10 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The name of the schema. /// The name of the table. /// The name of the column. - /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , , or is null. + /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) + public async Task DisableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -760,26 +774,19 @@ public async Task> CreateOrUpdateAsync(string sub Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); + using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - { - SensitivityLabelData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Creates or updates the sensitivity label of a given column. + /// Disables sensitivity recommendations on a given column. /// 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. @@ -787,11 +794,10 @@ public async Task> CreateOrUpdateAsync(string sub /// The name of the schema. /// The name of the table. /// The name of the column. - /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , , or is null. + /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) + public Response DisableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -800,30 +806,23 @@ public Response CreateOrUpdate(string subscriptionId, stri Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); + using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - { - SensitivityLabelData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -841,14 +840,15 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("current", true); + uri.AppendPath("recommended", true); + uri.AppendPath("/enable", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; _userAgent.Apply(message); return message; } - /// Deletes the sensitivity label of a given column. + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). /// 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. @@ -859,7 +859,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public async Task EnableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -869,7 +869,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -880,7 +880,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Deletes the sensitivity label of a given column. + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). /// 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. @@ -891,7 +891,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public Response EnableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -901,7 +901,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -912,6 +912,97 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s } } + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter) + { + 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("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/sensitivityLabels", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string databaseName, string skipToken, bool? count, string filter) { var message = _pipeline.CreateMessage(); @@ -1083,5 +1174,87 @@ public Response ListRecommendedByDatabaseNextPage(st throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// 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 name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// 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 name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByDatabaseNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs index afe9269c1edb4..4191eee8f5323 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseData.cs @@ -32,19 +32,17 @@ public RestorableDroppedDatabaseData() /// Resource tags. /// The name of the database. /// The max size of the database expressed in bytes. - /// DEPRECATED: The resource name of the elastic pool containing this database. This property is deprecated and the value will always be null. /// The creation date of the database (ISO8601 format). /// The deletion date of the database (ISO8601 format). /// The earliest restore date of the database (ISO8601 format). /// The storage account type used to store backups for this database. - internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SqlSku sku, string location, IDictionary tags, string databaseName, long? maxSizeBytes, string elasticPoolId, DateTimeOffset? creationOn, DateTimeOffset? deletionOn, DateTimeOffset? earliestRestoreOn, RestorableDroppedDatabasePropertiesBackupStorageRedundancy? backupStorageRedundancy) : base(id, name, resourceType, systemData) + internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SqlSku sku, string location, IDictionary tags, string databaseName, long? maxSizeBytes, DateTimeOffset? creationOn, DateTimeOffset? deletionOn, DateTimeOffset? earliestRestoreOn, BackupStorageRedundancy? backupStorageRedundancy) : base(id, name, resourceType, systemData) { Sku = sku; Location = location; Tags = tags; DatabaseName = databaseName; MaxSizeBytes = maxSizeBytes; - ElasticPoolId = elasticPoolId; CreationOn = creationOn; DeletionOn = deletionOn; EarliestRestoreOn = earliestRestoreOn; @@ -61,8 +59,6 @@ internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, Resou public string DatabaseName { get; } /// The max size of the database expressed in bytes. public long? MaxSizeBytes { get; } - /// DEPRECATED: The resource name of the elastic pool containing this database. This property is deprecated and the value will always be null. - public string ElasticPoolId { get; } /// The creation date of the database (ISO8601 format). public DateTimeOffset? CreationOn { get; } /// The deletion date of the database (ISO8601 format). @@ -70,6 +66,6 @@ internal RestorableDroppedDatabaseData(ResourceIdentifier id, string name, Resou /// The earliest restore date of the database (ISO8601 format). public DateTimeOffset? EarliestRestoreOn { get; } /// The storage account type used to store backups for this database. - public RestorableDroppedDatabasePropertiesBackupStorageRedundancy? BackupStorageRedundancy { get; } + public BackupStorageRedundancy? BackupStorageRedundancy { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs index 604cb62e51cb7..72bc19052c385 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs @@ -174,18 +174,18 @@ public virtual Response Get(Cancellatio } /// - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable - /// Operation Id: SensitivityLabels_EnableRecommendation + /// Disables sensitivity recommendations on a given column + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable + /// Operation Id: SensitivityLabels_DisableRecommendation /// /// The cancellation token to use. - public virtual async Task EnableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) + public virtual async Task DisableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -196,18 +196,18 @@ public virtual async Task EnableRecommendationSensitivityLabelAsync(Ca } /// - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable - /// Operation Id: SensitivityLabels_EnableRecommendation + /// Disables sensitivity recommendations on a given column + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable + /// Operation Id: SensitivityLabels_DisableRecommendation /// /// The cancellation token to use. - public virtual Response EnableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) + public virtual Response DisableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -218,18 +218,18 @@ public virtual Response EnableRecommendationSensitivityLabel(CancellationToken c } /// - /// Disables sensitivity recommendations on a given column - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable - /// Operation Id: SensitivityLabels_DisableRecommendation + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable + /// Operation Id: SensitivityLabels_EnableRecommendation /// /// The cancellation token to use. - public virtual async Task DisableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) + public virtual async Task EnableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -240,18 +240,18 @@ public virtual async Task DisableRecommendationSensitivityLabelAsync(C } /// - /// Disables sensitivity recommendations on a given column - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable - /// Operation Id: SensitivityLabels_DisableRecommendation + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable + /// Operation Id: SensitivityLabels_EnableRecommendation /// /// The cancellation token to use. - public virtual Response DisableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) + public virtual Response EnableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseData.cs index e8f804ad12e94..845f9375e8b77 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 resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, string kind, string managedBy, CreateMode? createMode, string collation, long? maxSizeBytes, SampleSchemaName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationOn, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInOn, DateTimeOffset? sourceDatabaseDeletionOn, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreOn, DatabaseReadScale? readScale, int? highAvailabilityReplicaCount, SecondaryType? secondaryType, SqlSku currentSku, int? autoPauseDelay, CurrentBackupStorageRedundancy? currentBackupStorageRedundancy, RequestedBackupStorageRedundancy? requestedBackupStorageRedundancy, double? minCapacity, DateTimeOffset? pausedOn, DateTimeOffset? resumedOn, string maintenanceConfigurationId, bool? isLedgerOn, bool? isInfraEncryptionEnabled) : base(id, name, resourceType, systemData, tags, location) + /// The Client id used for cross tenant per database CMK scenario. + /// The Primary Delegated Identity Client id used for per database CMK - for internal use only. + internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, string kind, string managedBy, DatabaseIdentity identity, CreateMode? createMode, string collation, long? maxSizeBytes, SampleSchemaName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationOn, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInOn, DateTimeOffset? sourceDatabaseDeletionOn, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreOn, DatabaseReadScale? readScale, int? highAvailabilityReplicaCount, SecondaryType? secondaryType, SqlSku currentSku, int? autoPauseDelay, BackupStorageRedundancy? currentBackupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy, double? minCapacity, DateTimeOffset? pausedOn, DateTimeOffset? resumedOn, string maintenanceConfigurationId, bool? isLedgerOn, bool? isInfraEncryptionEnabled, Guid? federatedClientId, Guid? primaryDelegatedIdentityClientId) : base(id, name, resourceType, 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 resour MaintenanceConfigurationId = maintenanceConfigurationId; IsLedgerOn = isLedgerOn; IsInfraEncryptionEnabled = isInfraEncryptionEnabled; + FederatedClientId = federatedClientId; + PrimaryDelegatedIdentityClientId = primaryDelegatedIdentityClientId; } /// @@ -163,6 +169,8 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour public string Kind { get; } /// Resource that manages the database. public string ManagedBy { get; } + /// The Azure Active Directory identity of the database. + public DatabaseIdentity Identity { get; set; } /// /// Specifies the mode of database creation. /// @@ -240,9 +248,9 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. public int? AutoPauseDelay { get; set; } /// The storage account type used to store backups for this database. - public CurrentBackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } /// The storage account type to be used to store backups for this database. - public RequestedBackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Minimal capacity that database will always have allocated, if not paused. public double? MinCapacity { get; set; } /// The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. @@ -255,5 +263,9 @@ internal SqlDatabaseData(ResourceIdentifier id, string name, ResourceType resour public bool? IsLedgerOn { get; set; } /// Infra encryption is enabled for this database. public bool? IsInfraEncryptionEnabled { get; } + /// The Client id used for cross tenant per database CMK scenario. + public Guid? FederatedClientId { get; set; } + /// The 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/SqlDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs index 35002cadec765..2758de11c4737 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs @@ -40,14 +40,14 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly DatabaseColumnsRestOperations _serverDatabaseSchemaTableColumnDatabaseColumnsRestClient; private readonly ClientDiagnostics _restorePointClientDiagnostics; private readonly RestorePointsRestOperations _restorePointRestClient; - private readonly ClientDiagnostics _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics; - private readonly SensitivityLabelsRestOperations _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient; private readonly ClientDiagnostics _databaseExtensionsClientDiagnostics; private readonly DatabaseExtensionsRestOperations _databaseExtensionsRestClient; private readonly ClientDiagnostics _databaseOperationsClientDiagnostics; private readonly DatabaseRestOperations _databaseOperationsRestClient; private readonly ClientDiagnostics _databaseUsagesClientDiagnostics; private readonly DatabaseUsagesRestOperations _databaseUsagesRestClient; + private readonly ClientDiagnostics _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics; + private readonly SensitivityLabelsRestOperations _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient; private readonly SqlDatabaseData _data; /// Initializes a new instance of the class for mocking. @@ -78,15 +78,15 @@ internal SqlDatabaseResource(ArmClient client, ResourceIdentifier id) : base(cli _restorePointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", RestorePointResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(RestorePointResource.ResourceType, out string restorePointApiVersion); _restorePointRestClient = new RestorePointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, restorePointApiVersion); - _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType, out string serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); - _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient = new SensitivityLabelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); _databaseExtensionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseExtensionsRestClient = new DatabaseExtensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _databaseOperationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseOperationsRestClient = new DatabaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _databaseUsagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseUsagesRestClient = new DatabaseUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServerDatabaseSchemaTableColumnSensitivityLabelResource.ResourceType, out string serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); + _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient = new SensitivityLabelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -156,43 +156,6 @@ public virtual Response GetGeoBackupPolicy(GeoBackupPol return GetGeoBackupPolicies().Get(geoBackupPolicyName, cancellationToken); } - /// Gets a collection of ReplicationLinkResources in the SqlDatabase. - /// An object representing collection of ReplicationLinkResources and their operations over a ReplicationLinkResource. - public virtual ReplicationLinkCollection GetReplicationLinks() - { - return GetCachedClient(Client => new ReplicationLinkCollection(Client, Id)); - } - - /// - /// Gets a replication link. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} - /// Operation Id: ReplicationLinks_Get - /// - /// The name of the replication link. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual async Task> GetReplicationLinkAsync(string linkId, CancellationToken cancellationToken = default) - { - return await GetReplicationLinks().GetAsync(linkId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a replication link. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} - /// Operation Id: ReplicationLinks_Get - /// - /// The name of the replication link. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual Response GetReplicationLink(string linkId, CancellationToken cancellationToken = default) - { - return GetReplicationLinks().Get(linkId, cancellationToken); - } - /// Gets a collection of ExtendedDatabaseBlobAuditingPolicyResources in the SqlDatabase. /// An object representing collection of ExtendedDatabaseBlobAuditingPolicyResources and their operations over a ExtendedDatabaseBlobAuditingPolicyResource. public virtual ExtendedDatabaseBlobAuditingPolicyCollection GetExtendedDatabaseBlobAuditingPolicies() @@ -696,6 +659,43 @@ public virtual Response GetLedgerDigestUploads(Ledg return GetLedgerDigestUploads().Get(ledgerDigestUploads, cancellationToken); } + /// Gets a collection of ReplicationLinkResources in the SqlDatabase. + /// An object representing collection of ReplicationLinkResources and their operations over a ReplicationLinkResource. + public virtual ReplicationLinkCollection GetReplicationLinks() + { + return GetCachedClient(Client => new ReplicationLinkCollection(Client, Id)); + } + + /// + /// Gets a replication link. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// Operation Id: ReplicationLinks_Get + /// + /// The name of the replication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetReplicationLinkAsync(string linkId, CancellationToken cancellationToken = default) + { + return await GetReplicationLinks().GetAsync(linkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a replication link. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// Operation Id: ReplicationLinks_Get + /// + /// The name of the replication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetReplicationLink(string linkId, CancellationToken cancellationToken = default) + { + return GetReplicationLinks().Get(linkId, cancellationToken); + } + /// /// Gets a database. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} @@ -1509,25 +1509,88 @@ public virtual ArmOperation CreateRestorePoint(WaitUntil w } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_ListCurrentByDatabase + /// Perform a database extension operation, like polybase import + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} + /// Operation Id: DatabaseExtensions_CreateOrUpdate /// - /// The String to use. - /// The Boolean to use. - /// An OData filter expression that filters elements in the collection. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The database import request parameters. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCurrentSensitivityLabelsAsync(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateDatabaseExtensionAsync(WaitUntil waitUntil, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); + scope.Start(); + try { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + var response = await _databaseExtensionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Perform a database extension operation, like polybase import + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} + /// Operation Id: DatabaseExtensions_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The database import request parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdateDatabaseExtension(WaitUntil waitUntil, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); + scope.Start(); + try + { + var response = _databaseExtensionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters, cancellationToken); + var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List database extension. This will return an empty list as it is not supported. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions + /// Operation Id: DatabaseExtensions_ListByDatabase + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseExtensionsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseExtensionsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1535,14 +1598,14 @@ async Task> FirstP throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseExtensionsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1554,25 +1617,22 @@ async Task> NextPa } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_ListCurrentByDatabase + /// List database extension. This will return an empty list as it is not supported. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions + /// Operation Id: DatabaseExtensions_ListByDatabase /// - /// The String to use. - /// The Boolean to use. - /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCurrentSensitivityLabels(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseExtensions(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseExtensionsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1580,14 +1640,14 @@ Page FirstPageFunc(int? throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); + using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseExtensionsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1599,22 +1659,19 @@ Page NextPageFunc(strin } /// - /// Update sensitivity labels of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_Update + /// Cancels the asynchronous operation on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel + /// Operation Id: DatabaseOperations_Cancel /// - /// The SensitivityLabelUpdateList to use. + /// The operation identifier. /// The cancellation token to use. - /// is null. - public virtual async Task UpdateSensitivityLabelAsync(SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + public virtual async Task CancelDatabaseOperationAsync(Guid operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken).ConfigureAwait(false); + var response = await _databaseOperationsRestClient.CancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1625,22 +1682,19 @@ public virtual async Task UpdateSensitivityLabelAsync(SensitivityLabel } /// - /// Update sensitivity labels of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels - /// Operation Id: SensitivityLabels_Update + /// Cancels the asynchronous operation on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel + /// Operation Id: DatabaseOperations_Cancel /// - /// The SensitivityLabelUpdateList to use. + /// The operation identifier. /// The cancellation token to use. - /// is null. - public virtual Response UpdateSensitivityLabel(SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + public virtual Response CancelDatabaseOperation(Guid operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken); + var response = _databaseOperationsRestClient.Cancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); return response; } catch (Exception e) @@ -1651,25 +1705,22 @@ public virtual Response UpdateSensitivityLabel(SensitivityLabelUpdateList parame } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_ListRecommendedByDatabase + /// Gets a list of operations performed on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations + /// Operation Id: DatabaseOperations_ListByDatabase /// - /// The String to use. - /// Specifies whether to include disabled recommendations or not. - /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRecommendedSensitivityLabelsAsync(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseOperationsAsync(CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseOperationsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1677,14 +1728,14 @@ async Task> FirstP throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = await _databaseOperationsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1696,25 +1747,22 @@ async Task> NextPa } /// - /// Gets the sensitivity labels of a given database - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_ListRecommendedByDatabase + /// Gets a list of operations performed on the database. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations + /// Operation Id: DatabaseOperations_ListByDatabase /// - /// The String to use. - /// Specifies whether to include disabled recommendations or not. - /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRecommendedSensitivityLabels(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseOperations(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseOperationsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1722,14 +1770,14 @@ Page FirstPageFunc(int? throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + var response = _databaseOperationsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1741,140 +1789,109 @@ Page NextPageFunc(strin } /// - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_UpdateRecommended - /// - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// is null. - public virtual async Task UpdateRecommendedSensitivityLabelAsync(RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); - scope.Start(); - try - { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommendedAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels - /// Operation Id: SensitivityLabels_UpdateRecommended - /// - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// is null. - public virtual Response UpdateRecommendedSensitivityLabel(RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); - scope.Start(); - try - { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommended(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Perform a database extension operation, like polybase import - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} - /// Operation Id: DatabaseExtensions_CreateOrUpdate + /// Gets database usages. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages + /// Operation Id: DatabaseUsages_ListByDatabase /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The String to use. - /// The database import request parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateDatabaseExtensionAsync(WaitUntil waitUntil, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseUsagesAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); - scope.Start(); - try + async Task> FirstPageFunc(int? pageSizeHint) { - var response = await _databaseExtensionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = await _databaseUsagesRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = await _databaseUsagesRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// - /// Perform a database extension operation, like polybase import - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName} - /// Operation Id: DatabaseExtensions_CreateOrUpdate + /// Gets database usages. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages + /// Operation Id: DatabaseUsages_ListByDatabase /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The String to use. - /// The database import request parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdateDatabaseExtension(WaitUntil waitUntil, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseUsages(CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); - Argument.AssertNotNull(parameters, nameof(parameters)); - - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.CreateOrUpdateDatabaseExtension"); - scope.Start(); - try + Page FirstPageFunc(int? pageSizeHint) { - var response = _databaseExtensionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters, cancellationToken); - var operation = new SqlArmOperation(new ImportExportExtensionsOperationResultOperationSource(), _databaseExtensionsClientDiagnostics, Pipeline, _databaseExtensionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, parameters).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = _databaseUsagesRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + scope.Start(); + try + { + var response = _databaseUsagesRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// - /// List database extension. This will return an empty list as it is not supported. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions - /// Operation Id: DatabaseExtensions_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_ListCurrentByDatabase /// + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatabaseExtensionsAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCurrentSensitivityLabelsAsync(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = await _databaseExtensionsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1882,14 +1899,14 @@ async Task> FirstPageFunc(int? pageS throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = await _databaseExtensionsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1901,22 +1918,25 @@ async Task> NextPageFunc(string next } /// - /// List database extension. This will return an empty list as it is not supported. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions - /// Operation Id: DatabaseExtensions_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_ListCurrentByDatabase /// + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatabaseExtensions(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCurrentSensitivityLabels(string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = _databaseExtensionsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1924,14 +1944,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseExtensionsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseExtensions"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetCurrentSensitivityLabels"); scope.Start(); try { - var response = _databaseExtensionsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListCurrentByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, count, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -1943,19 +1963,22 @@ Page NextPageFunc(string nextLink, int? p } /// - /// Cancels the asynchronous operation on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel - /// Operation Id: DatabaseOperations_Cancel + /// Update sensitivity labels of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_Update /// - /// The operation identifier. + /// The SensitivityLabelUpdateList to use. /// The cancellation token to use. - public virtual async Task CancelDatabaseOperationAsync(Guid operationId, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task UpdateSensitivityLabelAsync(SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); scope.Start(); try { - var response = await _databaseOperationsRestClient.CancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1966,19 +1989,22 @@ public virtual async Task CancelDatabaseOperationAsync(Guid operationI } /// - /// Cancels the asynchronous operation on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel - /// Operation Id: DatabaseOperations_Cancel + /// Update sensitivity labels of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels + /// Operation Id: SensitivityLabels_Update /// - /// The operation identifier. + /// The SensitivityLabelUpdateList to use. /// The cancellation token to use. - public virtual Response CancelDatabaseOperation(Guid operationId, CancellationToken cancellationToken = default) + /// is null. + public virtual Response UpdateSensitivityLabel(SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateSensitivityLabel"); scope.Start(); try { - var response = _databaseOperationsRestClient.Cancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken); return response; } catch (Exception e) @@ -1989,22 +2015,25 @@ public virtual Response CancelDatabaseOperation(Guid operationId, CancellationTo } /// - /// Gets a list of operations performed on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations - /// Operation Id: DatabaseOperations_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_ListRecommendedByDatabase /// + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatabaseOperationsAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRecommendedSensitivityLabelsAsync(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = await _databaseOperationsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2012,14 +2041,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = await _databaseOperationsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2031,22 +2060,25 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH } /// - /// Gets a list of operations performed on the database. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations - /// Operation Id: DatabaseOperations_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_ListRecommendedByDatabase /// + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatabaseOperations(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRecommendedSensitivityLabels(string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = _databaseOperationsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2054,14 +2086,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseOperations"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetRecommendedSensitivityLabels"); scope.Start(); try { - var response = _databaseOperationsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListRecommendedByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, skipToken, includeDisabledRecommendations, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2073,22 +2105,75 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets database usages. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages - /// Operation Id: DatabaseUsages_ListByDatabase + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_UpdateRecommended /// + /// The RecommendedSensitivityLabelUpdateList to use. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatabaseUsagesAsync(CancellationToken cancellationToken = default) + /// is null. + public virtual async Task UpdateRecommendedSensitivityLabelAsync(RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); + scope.Start(); + try { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommendedAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels + /// Operation Id: SensitivityLabels_UpdateRecommended + /// + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// is null. + public virtual Response UpdateRecommendedSensitivityLabel(RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(parameters, nameof(parameters)); + + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.UpdateRecommendedSensitivityLabel"); + scope.Start(); + try + { + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.UpdateRecommended(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: SensitivityLabels_ListByDatabase + /// + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSensitivityLabelsAsync(string filter = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); scope.Start(); try { - var response = await _databaseUsagesRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2096,14 +2181,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); scope.Start(); try { - var response = await _databaseUsagesRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2115,22 +2200,23 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) } /// - /// Gets database usages. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages - /// Operation Id: DatabaseUsages_ListByDatabase + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: SensitivityLabels_ListByDatabase /// + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatabaseUsages(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSensitivityLabels(string filter = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); scope.Start(); try { - var response = _databaseUsagesRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -2138,14 +2224,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _databaseUsagesClientDiagnostics.CreateScope("SqlDatabaseResource.GetDatabaseUsages"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); scope.Start(); try { - var response = _databaseUsagesRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs index 89c22e5872ba1..be5de392ceef3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs @@ -39,8 +39,6 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ServersRestOperations _sqlServerServersRestClient; private readonly ClientDiagnostics _sqlDatabaseDatabasesClientDiagnostics; private readonly DatabasesRestOperations _sqlDatabaseDatabasesRestClient; - private readonly ClientDiagnostics _replicationLinkClientDiagnostics; - private readonly ReplicationLinksRestOperations _replicationLinkRestClient; private readonly ClientDiagnostics _serverUsagesClientDiagnostics; private readonly ServerUsagesRestOperations _serverUsagesRestClient; private readonly ClientDiagnostics _firewallRuleClientDiagnostics; @@ -49,6 +47,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ServerRestOperations _serverOperationsRestClient; private readonly ClientDiagnostics _tdeCertificatesClientDiagnostics; private readonly TdeCertificatesRestOperations _tdeCertificatesRestClient; + private readonly ClientDiagnostics _replicationLinkClientDiagnostics; + private readonly ReplicationLinksRestOperations _replicationLinkRestClient; private readonly SqlServerData _data; /// Initializes a new instance of the class for mocking. @@ -76,9 +76,6 @@ internal SqlServerResource(ArmClient client, ResourceIdentifier id) : base(clien _sqlDatabaseDatabasesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", SqlDatabaseResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(SqlDatabaseResource.ResourceType, out string sqlDatabaseDatabasesApiVersion); _sqlDatabaseDatabasesRestClient = new DatabasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sqlDatabaseDatabasesApiVersion); - _replicationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ReplicationLinkResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ReplicationLinkResource.ResourceType, out string replicationLinkApiVersion); - _replicationLinkRestClient = new ReplicationLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, replicationLinkApiVersion); _serverUsagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _serverUsagesRestClient = new ServerUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _firewallRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", FirewallRuleResource.ResourceType.Namespace, Diagnostics); @@ -88,6 +85,9 @@ internal SqlServerResource(ArmClient client, ResourceIdentifier id) : base(clien _serverOperationsRestClient = new ServerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _tdeCertificatesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _tdeCertificatesRestClient = new TdeCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _replicationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ReplicationLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ReplicationLinkResource.ResourceType, out string replicationLinkApiVersion); + _replicationLinkRestClient = new ReplicationLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, replicationLinkApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -1300,90 +1300,6 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// - /// Gets a list of replication links. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks - /// Operation Id: ReplicationLinks_ListByServer - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetReplicationLinksAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); - scope.Start(); - try - { - var response = await _replicationLinkRestClient.ListByServerAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); - scope.Start(); - try - { - var response = await _replicationLinkRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Gets a list of replication links. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks - /// Operation Id: ReplicationLinks_ListByServer - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetReplicationLinks(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); - scope.Start(); - try - { - var response = _replicationLinkRestClient.ListByServer(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); - scope.Start(); - try - { - var response = _replicationLinkRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - /// /// Returns server usages. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages @@ -1694,6 +1610,90 @@ public virtual ArmOperation ImportDatabase(WaitUnti } } + /// + /// Gets a list of replication links. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks + /// Operation Id: ReplicationLinks_ListByServer + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReplicationLinksAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); + scope.Start(); + try + { + var response = await _replicationLinkRestClient.ListByServerAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); + scope.Start(); + try + { + var response = await _replicationLinkRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a list of replication links. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks + /// Operation Id: ReplicationLinks_ListByServer + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReplicationLinks(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); + scope.Start(); + try + { + var response = _replicationLinkRestClient.ListByServer(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _replicationLinkClientDiagnostics.CreateScope("SqlServerResource.GetReplicationLinks"); + scope.Start(); + try + { + var response = _replicationLinkRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ReplicationLinkResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + /// /// Add a tag to the current resource. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index e9b1d1c3877e6..e7f6b2585dc50 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/cd38739689274780403d962641e67ea691877e63/specification/sql/resource-manager/readme.md namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated model-namespace: false