diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs index fd4155e12c41c..39fdde3add2c2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs @@ -632,7 +632,9 @@ protected InstancePoolCollection() { } public partial class InstancePoolData : Azure.ResourceManager.Models.TrackedResourceData { public InstancePoolData(Azure.Core.AzureLocation location) { } + public string DnsZone { get { throw null; } } public Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? LicenseType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier MaintenanceConfigurationId { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public int? VCores { get { throw null; } set { } } @@ -698,6 +700,43 @@ protected IPv6FirewallRuleResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.IPv6FirewallRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.IPv6FirewallRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class JobPrivateEndpointCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected JobPrivateEndpointCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string privateEndpointName, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string privateEndpointName, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class JobPrivateEndpointData : Azure.ResourceManager.Models.ResourceData + { + public JobPrivateEndpointData() { } + public string PrivateEndpointId { get { throw null; } } + public Azure.Core.ResourceIdentifier TargetServerAzureResourceId { get { throw null; } set { } } + } + public partial class JobPrivateEndpointResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected JobPrivateEndpointResource() { } + public virtual Azure.ResourceManager.Sql.JobPrivateEndpointData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class LedgerDigestUploadCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected LedgerDigestUploadCollection() { } @@ -774,9 +813,11 @@ public partial class LongTermRetentionBackupData : Azure.ResourceManager.Models. public LongTermRetentionBackupData() { } public System.DateTimeOffset? BackupExpireOn { get { throw null; } } public System.DateTimeOffset? BackupOn { get { throw null; } } + public Azure.ResourceManager.Sql.Models.BackupStorageAccessTier? BackupStorageAccessTier { get { throw null; } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? BackupStorageRedundancy { get { throw null; } } public System.DateTimeOffset? DatabaseDeletedOn { get { throw null; } } public string DatabaseName { get { throw null; } } + public bool? IsBackupImmutable { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? RequestedBackupStorageRedundancy { get { throw null; } set { } } public System.DateTimeOffset? ServerCreateOn { get { throw null; } } public string ServerName { get { throw null; } } @@ -801,6 +842,8 @@ protected LongTermRetentionPolicyCollection() { } public partial class LongTermRetentionPolicyData : Azure.ResourceManager.Models.ResourceData { public LongTermRetentionPolicyData() { } + public Azure.ResourceManager.Sql.Models.BackupStorageAccessTier? BackupStorageAccessTier { get { throw null; } set { } } + public bool? MakeBackupsImmutable { get { throw null; } set { } } public string MonthlyRetention { get { throw null; } set { } } public string WeeklyRetention { get { throw null; } set { } } public int? WeekOfYear { get { throw null; } set { } } @@ -2401,6 +2444,8 @@ public partial class ResourceGroupLongTermRetentionBackupResource : Azure.Resour protected ResourceGroupLongTermRetentionBackupResource() { } public virtual Azure.ResourceManager.Sql.LongTermRetentionBackupData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public virtual Azure.ResourceManager.ArmOperation ChangeAccessTierByResourceGroup(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ChangeAccessTierByResourceGroupAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation CopyByResourceGroup(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.CopyLongTermRetentionBackupContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CopyByResourceGroupAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.CopyLongTermRetentionBackupContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { throw null; } @@ -3411,6 +3456,7 @@ public static partial class SqlExtensions public static Azure.Pageable GetInstancePools(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetInstancePoolsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Sql.IPv6FirewallRuleResource GetIPv6FirewallRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Sql.JobPrivateEndpointResource GetJobPrivateEndpointResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Sql.LedgerDigestUploadResource GetLedgerDigestUploadResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Sql.LogicalDatabaseTransparentDataEncryptionResource GetLogicalDatabaseTransparentDataEncryptionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -4194,6 +4240,9 @@ protected SqlServerJobAgentResource() { } public virtual Azure.Pageable GetJobExecutionsByAgent(System.DateTimeOffset? createTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? createTimeMax = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMax = default(System.DateTimeOffset?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetJobExecutionsByAgentAsync(Azure.ResourceManager.Sql.Models.SqlServerJobAgentResourceGetJobExecutionsByAgentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetJobExecutionsByAgentAsync(System.DateTimeOffset? createTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? createTimeMax = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMax = default(System.DateTimeOffset?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetJobPrivateEndpoint(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetJobPrivateEndpointAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.JobPrivateEndpointCollection GetJobPrivateEndpoints() { throw null; } public virtual Azure.Response GetSqlServerJob(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetSqlServerJobAsync(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetSqlServerJobCredential(string credentialName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -5131,6 +5180,8 @@ public partial class SubscriptionLongTermRetentionBackupResource : Azure.Resourc protected SubscriptionLongTermRetentionBackupResource() { } public virtual Azure.ResourceManager.Sql.LongTermRetentionBackupData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public virtual Azure.ResourceManager.ArmOperation ChangeAccessTier(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ChangeAccessTierAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation Copy(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.CopyLongTermRetentionBackupContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CopyAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.CopyLongTermRetentionBackupContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { throw null; } @@ -5529,6 +5580,7 @@ protected MockableSqlArmClient() { } public virtual Azure.ResourceManager.Sql.InstanceFailoverGroupResource GetInstanceFailoverGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.InstancePoolResource GetInstancePoolResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.IPv6FirewallRuleResource GetIPv6FirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.JobPrivateEndpointResource GetJobPrivateEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.LedgerDigestUploadResource GetLedgerDigestUploadResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.LogicalDatabaseTransparentDataEncryptionResource GetLogicalDatabaseTransparentDataEncryptionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } @@ -5842,7 +5894,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.ImportExportExtensionsOperationResult ImportExportExtensionsOperationResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string lastModifiedTime = null, string serverName = null, string databaseName = null, string status = null, string errorMessage = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ImportExportOperationResult ImportExportOperationResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string queuedTime = null, string lastModifiedTime = null, System.Uri blobUri = null, string serverName = null, string databaseName = null, string status = null, string errorMessage = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } public static Azure.ResourceManager.Sql.InstanceFailoverGroupData InstanceFailoverGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType? secondaryType = default(Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType?), Azure.ResourceManager.Sql.Models.InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint = null, Azure.ResourceManager.Sql.Models.ReadOnlyEndpointFailoverPolicy? readOnlyEndpointFailoverPolicy = default(Azure.ResourceManager.Sql.Models.ReadOnlyEndpointFailoverPolicy?), Azure.ResourceManager.Sql.Models.InstanceFailoverGroupReplicationRole? replicationRole = default(Azure.ResourceManager.Sql.Models.InstanceFailoverGroupReplicationRole?), string replicationState = null, System.Collections.Generic.IEnumerable partnerRegions = null, System.Collections.Generic.IEnumerable managedInstancePairs = null) { throw null; } - public static Azure.ResourceManager.Sql.InstancePoolData InstancePoolData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, int? vCores = default(int?), Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.InstancePoolLicenseType?)) { throw null; } + public static Azure.ResourceManager.Sql.InstancePoolData InstancePoolData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, int? vCores = default(int?), Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.InstancePoolLicenseType?), string dnsZone = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null) { throw null; } public static Azure.ResourceManager.Sql.Models.InstancePoolEditionCapability InstancePoolEditionCapability(string name = null, System.Collections.Generic.IEnumerable supportedFamilies = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.Models.InstancePoolFamilyCapability InstancePoolFamilyCapability(string name = null, System.Collections.Generic.IEnumerable supportedLicenseTypes = null, System.Collections.Generic.IEnumerable supportedVcoresValues = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.Models.InstancePoolUsage InstancePoolUsage(Azure.Core.ResourceIdentifier id = null, Azure.ResourceManager.Sql.Models.InstancePoolUsageName name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string unit = null, int? currentValue = default(int?), int? limit = default(int?), int? requestedLimit = default(int?)) { throw null; } @@ -5850,13 +5902,14 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.InstancePoolVcoresCapability InstancePoolVcoresCapability(string name = null, int? value = default(int?), Azure.ResourceManager.Sql.Models.MaxSizeCapability storageLimit = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.IPv6FirewallRuleData IPv6FirewallRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string startIPv6Address = null, string endIPv6Address = null) { throw null; } public static Azure.ResourceManager.Sql.Models.JobExecutionTarget JobExecutionTarget(Azure.ResourceManager.Sql.Models.JobTargetType? targetType = default(Azure.ResourceManager.Sql.Models.JobTargetType?), string serverName = null, string databaseName = null) { throw null; } + public static Azure.ResourceManager.Sql.JobPrivateEndpointData JobPrivateEndpointData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier targetServerAzureResourceId = null, string privateEndpointId = null) { throw null; } public static Azure.ResourceManager.Sql.LedgerDigestUploadData LedgerDigestUploadData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string digestStorageEndpoint = null, Azure.ResourceManager.Sql.Models.LedgerDigestUploadsState? state = default(Azure.ResourceManager.Sql.Models.LedgerDigestUploadsState?)) { throw null; } public static Azure.ResourceManager.Sql.Models.LicenseTypeCapability LicenseTypeCapability(string name = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.LogicalDatabaseTransparentDataEncryptionData LogicalDatabaseTransparentDataEncryptionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.TransparentDataEncryptionState? state = default(Azure.ResourceManager.Sql.Models.TransparentDataEncryptionState?)) { throw null; } public static Azure.ResourceManager.Sql.Models.LogSizeCapability LogSizeCapability(int? limit = default(int?), Azure.ResourceManager.Sql.Models.LogSizeUnit? unit = default(Azure.ResourceManager.Sql.Models.LogSizeUnit?)) { throw null; } - public static Azure.ResourceManager.Sql.LongTermRetentionBackupData LongTermRetentionBackupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string serverName = null, System.DateTimeOffset? serverCreateOn = default(System.DateTimeOffset?), string databaseName = null, System.DateTimeOffset? databaseDeletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? backupOn = default(System.DateTimeOffset?), System.DateTimeOffset? backupExpireOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? backupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?)) { throw null; } + public static Azure.ResourceManager.Sql.LongTermRetentionBackupData LongTermRetentionBackupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string serverName = null, System.DateTimeOffset? serverCreateOn = default(System.DateTimeOffset?), string databaseName = null, System.DateTimeOffset? databaseDeletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? backupOn = default(System.DateTimeOffset?), System.DateTimeOffset? backupExpireOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? backupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isBackupImmutable = default(bool?), Azure.ResourceManager.Sql.Models.BackupStorageAccessTier? backupStorageAccessTier = default(Azure.ResourceManager.Sql.Models.BackupStorageAccessTier?)) { throw null; } public static Azure.ResourceManager.Sql.Models.LongTermRetentionBackupOperationResult LongTermRetentionBackupOperationResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string operationType = null, Azure.Core.ResourceIdentifier fromBackupResourceId = null, Azure.Core.ResourceIdentifier toBackupResourceId = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? targetBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), string status = null, string message = null) { throw null; } - public static Azure.ResourceManager.Sql.LongTermRetentionPolicyData LongTermRetentionPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string weeklyRetention = null, string monthlyRetention = null, string yearlyRetention = null, int? weekOfYear = default(int?)) { throw null; } + public static Azure.ResourceManager.Sql.LongTermRetentionPolicyData LongTermRetentionPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? makeBackupsImmutable = default(bool?), Azure.ResourceManager.Sql.Models.BackupStorageAccessTier? backupStorageAccessTier = default(Azure.ResourceManager.Sql.Models.BackupStorageAccessTier?), string weeklyRetention = null, string monthlyRetention = null, string yearlyRetention = null, int? weekOfYear = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.Models.MaintenanceConfigurationCapability MaintenanceConfigurationCapability(string name = null, bool? isZoneRedundant = default(bool?), Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.MaintenanceWindowOptionData MaintenanceWindowOptionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? isEnabled = default(bool?), System.Collections.Generic.IEnumerable maintenanceWindowCycles = null, int? minDurationInMinutes = default(int?), int? defaultDurationInMinutes = default(int?), int? minCycles = default(int?), int? timeGranularityInMinutes = default(int?), bool? allowMultipleMaintenanceWindowsPerCycle = default(bool?)) { throw null; } public static Azure.ResourceManager.Sql.MaintenanceWindowsData MaintenanceWindowsData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IEnumerable timeRanges = null) { throw null; } @@ -6121,6 +6174,24 @@ internal AutoPauseDelayTimeRange() { } public Azure.ResourceManager.Sql.Models.PauseDelayTimeUnit? Unit { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct BackupStorageAccessTier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public BackupStorageAccessTier(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.BackupStorageAccessTier Archive { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.BackupStorageAccessTier Hot { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.BackupStorageAccessTier other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.BackupStorageAccessTier left, Azure.ResourceManager.Sql.Models.BackupStorageAccessTier right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.BackupStorageAccessTier (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.BackupStorageAccessTier left, Azure.ResourceManager.Sql.Models.BackupStorageAccessTier right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct BlobAuditingPolicyName : System.IEquatable { private readonly object _dummy; @@ -6160,6 +6231,12 @@ public enum BlobAuditingPolicyState public static bool operator !=(Azure.ResourceManager.Sql.Models.CatalogCollationType left, Azure.ResourceManager.Sql.Models.CatalogCollationType right) { throw null; } public override string ToString() { throw null; } } + public partial class ChangeLongTermRetentionBackupAccessTierParameters + { + public ChangeLongTermRetentionBackupAccessTierParameters(string backupStorageAccessTier, string operationMode) { } + public string BackupStorageAccessTier { get { throw null; } } + public string OperationMode { get { throw null; } } + } public partial class CompleteDatabaseRestoreDefinition { public CompleteDatabaseRestoreDefinition(string lastBackupName) { } @@ -6875,7 +6952,13 @@ internal InstancePoolFamilyCapability() { } public partial class InstancePoolPatch { public InstancePoolPatch() { } + public string DnsZone { get { throw null; } } + public Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? LicenseType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier MaintenanceConfigurationId { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public int? VCores { get { throw null; } set { } } } public partial class InstancePoolUsage { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs index 26fcc9d57f269..e4fd137d825b1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs @@ -19,12 +19,48 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_InstancePoolCollection { + // List instance pools by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListInstancePoolsByResourceGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListInstancePoolsByResourceGroup.json + // this example is just showing the usage of "InstancePools_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstancePoolResource + InstancePoolCollection collection = resourceGroupResource.GetInstancePools(); + + // invoke the operation and iterate over the result + await foreach (InstancePoolResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InstancePoolData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + // Get an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +94,7 @@ public async Task Get_GetAnInstancePool() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +124,7 @@ public async Task Exists_GetAnInstancePool() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,7 +166,7 @@ public async Task GetIfExists_GetAnInstancePool() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAnInstancePoolWithAllProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMax.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateInstancePoolMax.json // this example is just showing the usage of "InstancePools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -160,6 +196,7 @@ public async Task CreateOrUpdate_CreateAnInstancePoolWithAllProperties() SubnetId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1"), VCores = 8, LicenseType = InstancePoolLicenseType.LicenseIncluded, + MaintenanceConfigurationId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), Tags = { ["a"] = "b", @@ -180,7 +217,7 @@ public async Task CreateOrUpdate_CreateAnInstancePoolWithAllProperties() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAnInstancePoolWithMinProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMin.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateInstancePoolMin.json // this example is just showing the usage of "InstancePools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -220,41 +257,5 @@ public async Task CreateOrUpdate_CreateAnInstancePoolWithMinProperties() // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - - // List instance pools by resource group - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_ListInstancePoolsByResourceGroup() - { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsByResourceGroup.json - // this example is just showing the usage of "InstancePools_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "group1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this InstancePoolResource - InstancePoolCollection collection = resourceGroupResource.GetInstancePools(); - - // invoke the operation and iterate over the result - await foreach (InstancePoolResource item in collection.GetAllAsync()) - { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - InstancePoolData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs index 9253c0e9d9cfb..51420da52bee4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs @@ -19,13 +19,13 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_InstancePoolResource { - // Get an instance pool + // List instance pool usages expanded with children. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetAnInstancePool() + public async Task GetUsages_ListInstancePoolUsagesExpandedWithChildren() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json - // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json + // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -40,23 +40,23 @@ public async Task Get_GetAnInstancePool() ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation - InstancePoolResource result = await instancePool.GetAsync(); + // invoke the operation and iterate over the result + bool? expandChildren = true; + await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync(expandChildren: expandChildren)) + { + Console.WriteLine($"Succeeded: {item}"); + } - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - InstancePoolData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } - // Delete an instance pool + // List instance pool usages. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_DeleteAnInstancePool() + public async Task GetUsages_ListInstancePoolUsages() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteInstancePool.json - // this example is just showing the usage of "InstancePools_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json + // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -71,19 +71,22 @@ public async Task Delete_DeleteAnInstancePool() ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation - await instancePool.DeleteAsync(WaitUntil.Completed); + // invoke the operation and iterate over the result + await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } Console.WriteLine($"Succeeded"); } - // Patch an instance pool + // List managed instances by instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_PatchAnInstancePool() + public async Task GetManagedInstances_ListManagedInstancesByInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PatchInstancePool.json - // this example is just showing the usage of "InstancePools_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePool.json + // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -92,55 +95,52 @@ public async Task Update_PatchAnInstancePool() // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "group1"; - string instancePoolName = "testIP"; + string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string resourceGroupName = "Test1"; + string instancePoolName = "pool1"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation - InstancePoolPatch patch = new InstancePoolPatch() + // invoke the operation and iterate over the result + await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) { - Tags = -{ -["x"] = "y", -}, - }; - ArmOperation lro = await instancePool.UpdateAsync(WaitUntil.Completed, patch); - InstancePoolResource result = lro.Value; + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedInstanceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - InstancePoolData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } - // List instance pools in the subscription + // List managed instances by instance pool with $expand=administrators/activedirectory [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetInstancePools_ListInstancePoolsInTheSubscription() + public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsBySubscriptionId.json - // this example is just showing the usage of "InstancePools_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json + // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + // this example assumes you already have this InstancePoolResource created on azure + // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource + string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string resourceGroupName = "Test1"; + string instancePoolName = "pool1"; + ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); + InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); // invoke the operation and iterate over the result - await foreach (InstancePoolResource item in subscriptionResource.GetInstancePoolsAsync()) + await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - InstancePoolData resourceData = item.Data; + ManagedInstanceData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -148,44 +148,45 @@ public async Task GetInstancePools_ListInstancePoolsInTheSubscription() Console.WriteLine($"Succeeded"); } - // List instance pool usages expanded with children. + // List instance pools in the subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetUsages_ListInstancePoolUsagesExpandedWithChildren() + public async Task GetInstancePools_ListInstancePoolsInTheSubscription() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json - // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListInstancePoolsBySubscriptionId.json + // this example is just showing the usage of "InstancePools_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this InstancePoolResource created on azure - // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "group1"; - string instancePoolName = "testIP"; - ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); - InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - bool? expandChildren = true; - await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync(expandChildren: expandChildren)) + await foreach (InstancePoolResource item in subscriptionResource.GetInstancePoolsAsync()) { - Console.WriteLine($"Succeeded: {item}"); + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InstancePoolData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine($"Succeeded"); } - // List instance pool usages. + // Get an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetUsages_ListInstancePoolUsages() + public async Task Get_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json - // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json + // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -200,22 +201,23 @@ public async Task GetUsages_ListInstancePoolUsages() ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation and iterate over the result - await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } + // invoke the operation + InstancePoolResource result = await instancePool.GetAsync(); - Console.WriteLine($"Succeeded"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InstancePoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // List managed instances by instance pool + // Delete an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetManagedInstances_ListManagedInstancesByInstancePool() + public async Task Delete_DeleteAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePool.json - // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/DeleteInstancePool.json + // this example is just showing the usage of "InstancePools_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -224,32 +226,25 @@ public async Task GetManagedInstances_ListManagedInstancesByInstancePool() // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; - string resourceGroupName = "Test1"; - string instancePoolName = "pool1"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string instancePoolName = "testIP"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation and iterate over the result - await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) - { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ManagedInstanceData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + // invoke the operation + await instancePool.DeleteAsync(WaitUntil.Completed); Console.WriteLine($"Succeeded"); } - // List managed instances by instance pool with $expand=administrators/activedirectory + // Patch an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory() + public async Task Update_PatchAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json - // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/PatchInstancePool.json + // this example is just showing the usage of "InstancePools_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -258,23 +253,28 @@ public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpa // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; - string resourceGroupName = "Test1"; - string instancePoolName = "pool1"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string instancePoolName = "testIP"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation and iterate over the result - await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) + // invoke the operation + InstancePoolPatch patch = new InstancePoolPatch() { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ManagedInstanceData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + Tags = +{ +["x"] = "y", +}, + }; + ArmOperation lro = await instancePool.UpdateAsync(WaitUntil.Completed, patch); + InstancePoolResource result = lro.Value; - Console.WriteLine($"Succeeded"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InstancePoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointCollection.cs new file mode 100644 index 0000000000000..c79ee0038e8c5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Samples +{ + public partial class Sample_JobPrivateEndpointCollection + { + // List private endpoints in a job agent + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListPrivateEndpointsInAJobAgent() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListJobPrivateEndpointsByAgent.json + // this example is just showing the usage of "JobPrivateEndpoints_ListByAgent" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation and iterate over the result + await foreach (JobPrivateEndpointResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + JobPrivateEndpointData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + JobPrivateEndpointResource result = await collection.GetAsync(privateEndpointName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + bool result = await collection.ExistsAsync(privateEndpointName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointName); + JobPrivateEndpointResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + JobPrivateEndpointData data = new JobPrivateEndpointData() + { + TargetServerAzureResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/targetserver1"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointName, data); + JobPrivateEndpointResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointResource.cs new file mode 100644 index 0000000000000..1fa1cc1e642b3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Samples +{ + public partial class Sample_JobPrivateEndpointResource + { + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this JobPrivateEndpointResource created on azure + // for more information of creating JobPrivateEndpointResource, please refer to the document of JobPrivateEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string privateEndpointName = "endpoint1"; + ResourceIdentifier jobPrivateEndpointResourceId = JobPrivateEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + JobPrivateEndpointResource jobPrivateEndpoint = client.GetJobPrivateEndpointResource(jobPrivateEndpointResourceId); + + // invoke the operation + JobPrivateEndpointResource result = await jobPrivateEndpoint.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this JobPrivateEndpointResource created on azure + // for more information of creating JobPrivateEndpointResource, please refer to the document of JobPrivateEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string privateEndpointName = "endpoint1"; + ResourceIdentifier jobPrivateEndpointResourceId = JobPrivateEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + JobPrivateEndpointResource jobPrivateEndpoint = client.GetJobPrivateEndpointResource(jobPrivateEndpointResourceId); + + // invoke the operation + JobPrivateEndpointData data = new JobPrivateEndpointData() + { + TargetServerAzureResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/targetserver1"), + }; + ArmOperation lro = await jobPrivateEndpoint.UpdateAsync(WaitUntil.Completed, data); + JobPrivateEndpointResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete a private endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/DeleteJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this JobPrivateEndpointResource created on azure + // for more information of creating JobPrivateEndpointResource, please refer to the document of JobPrivateEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string privateEndpointName = "endpoint1"; + ResourceIdentifier jobPrivateEndpointResourceId = JobPrivateEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + JobPrivateEndpointResource jobPrivateEndpoint = client.GetJobPrivateEndpointResource(jobPrivateEndpointResourceId); + + // invoke the operation + await jobPrivateEndpoint.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs index 81231e40dc950..eea1601d8f483 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs @@ -18,12 +18,50 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_LongTermRetentionPolicyCollection { + // Get the long term retention policy for the database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetTheLongTermRetentionPolicyForTheDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionPolicyListByDatabase.json + // this example is just showing the usage of "LongTermRetentionPolicies_ListByDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "resourceGroup"; + string serverName = "testserver"; + string databaseName = "testDatabase"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this LongTermRetentionPolicyResource + LongTermRetentionPolicyCollection collection = sqlDatabase.GetLongTermRetentionPolicies(); + + // invoke the operation and iterate over the result + await foreach (LongTermRetentionPolicyResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LongTermRetentionPolicyData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + // Get the long term retention policy for the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetTheLongTermRetentionPolicyForTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionPolicyGet.json // this example is just showing the usage of "LongTermRetentionPolicies_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +97,7 @@ public async Task Get_GetTheLongTermRetentionPolicyForTheDatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetTheLongTermRetentionPolicyForTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionPolicyGet.json // this example is just showing the usage of "LongTermRetentionPolicies_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +129,7 @@ public async Task Exists_GetTheLongTermRetentionPolicyForTheDatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetTheLongTermRetentionPolicyForTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionPolicyGet.json // this example is just showing the usage of "LongTermRetentionPolicies_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -135,7 +173,7 @@ public async Task GetIfExists_GetTheLongTermRetentionPolicyForTheDatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateTheLongTermRetentionPolicyForTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json // this example is just showing the usage of "LongTermRetentionPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -159,6 +197,8 @@ public async Task CreateOrUpdate_CreateOrUpdateTheLongTermRetentionPolicyForTheD LongTermRetentionPolicyName policyName = LongTermRetentionPolicyName.Default; LongTermRetentionPolicyData data = new LongTermRetentionPolicyData() { + MakeBackupsImmutable = true, + BackupStorageAccessTier = BackupStorageAccessTier.Hot, WeeklyRetention = "P1M", MonthlyRetention = "P1Y", YearlyRetention = "P5Y", @@ -173,43 +213,5 @@ public async Task CreateOrUpdate_CreateOrUpdateTheLongTermRetentionPolicyForTheD // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - - // Get the long term retention policy for the database. - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GetTheLongTermRetentionPolicyForTheDatabase() - { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyListByDatabase.json - // this example is just showing the usage of "LongTermRetentionPolicies_ListByDatabase" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SqlDatabaseResource created on azure - // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "resourceGroup"; - string serverName = "testserver"; - string databaseName = "testDatabase"; - ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); - SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); - - // get the collection of this LongTermRetentionPolicyResource - LongTermRetentionPolicyCollection collection = sqlDatabase.GetLongTermRetentionPolicies(); - - // invoke the operation and iterate over the result - await foreach (LongTermRetentionPolicyResource item in collection.GetAllAsync()) - { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - LongTermRetentionPolicyData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyResource.cs index 234847382a102..9113199e42b72 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyResource.cs @@ -23,7 +23,7 @@ public partial class Sample_LongTermRetentionPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetTheLongTermRetentionPolicyForTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionPolicyGet.json // this example is just showing the usage of "LongTermRetentionPolicies_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task Get_GetTheLongTermRetentionPolicyForTheDatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateOrUpdateTheLongTermRetentionPolicyForTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json // this example is just showing the usage of "LongTermRetentionPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -77,6 +77,8 @@ public async Task Update_CreateOrUpdateTheLongTermRetentionPolicyForTheDatabase( // invoke the operation LongTermRetentionPolicyData data = new LongTermRetentionPolicyData() { + MakeBackupsImmutable = true, + BackupStorageAccessTier = BackupStorageAccessTier.Hot, WeeklyRetention = "P1M", MonthlyRetention = "P1Y", YearlyRetention = "P5Y", diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs index 9da730005e0f0..75e59bd7e318c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_ResourceGroupLongTermRetentionBackupCollection { - // Get the long term retention backup. + // Get all long term retention backups under the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetTheLongTermRetentionBackup() + public async Task GetAll_GetAllLongTermRetentionBackupsUnderTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json - // this example is just showing the usage of "LongTermRetentionBackups_GetByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByDatabase.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByResourceGroupDatabase" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -44,23 +44,25 @@ public async Task Get_GetTheLongTermRetentionBackup() string longTermRetentionDatabaseName = "testDatabase"; ResourceGroupLongTermRetentionBackupCollection collection = resourceGroupResource.GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - // invoke the operation - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; - ResourceGroupLongTermRetentionBackupResource result = await collection.GetAsync(backupName); + // invoke the operation and iterate over the result + await foreach (ResourceGroupLongTermRetentionBackupResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LongTermRetentionBackupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - LongTermRetentionBackupData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_GetTheLongTermRetentionBackup() + public async Task Get_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json // this example is just showing the usage of "LongTermRetentionBackups_GetByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,18 +84,22 @@ public async Task Exists_GetTheLongTermRetentionBackup() ResourceGroupLongTermRetentionBackupCollection collection = resourceGroupResource.GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); // invoke the operation - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; - bool result = await collection.ExistsAsync(backupName); + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; + ResourceGroupLongTermRetentionBackupResource result = await collection.GetAsync(backupName); - Console.WriteLine($"Succeeded: {result}"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_GetTheLongTermRetentionBackup() + public async Task Exists_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json // this example is just showing the usage of "LongTermRetentionBackups_GetByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,31 +121,19 @@ public async Task GetIfExists_GetTheLongTermRetentionBackup() ResourceGroupLongTermRetentionBackupCollection collection = resourceGroupResource.GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); // invoke the operation - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; - NullableResponse response = await collection.GetIfExistsAsync(backupName); - ResourceGroupLongTermRetentionBackupResource result = response.HasValue ? response.Value : null; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; + bool result = await collection.ExistsAsync(backupName); - if (result == null) - { - Console.WriteLine($"Succeeded with null as result"); - } - else - { - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - LongTermRetentionBackupData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + Console.WriteLine($"Succeeded: {result}"); } - // Get all long term retention backups under the database. + // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GetAllLongTermRetentionBackupsUnderTheDatabase() + public async Task GetIfExists_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByDatabase.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByResourceGroupDatabase" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionBackups_GetByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -159,17 +153,23 @@ public async Task GetAll_GetAllLongTermRetentionBackupsUnderTheDatabase() string longTermRetentionDatabaseName = "testDatabase"; ResourceGroupLongTermRetentionBackupCollection collection = resourceGroupResource.GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - // invoke the operation and iterate over the result - await foreach (ResourceGroupLongTermRetentionBackupResource item in collection.GetAllAsync()) + // invoke the operation + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + ResourceGroupLongTermRetentionBackupResource result = response.HasValue ? response.Value : null; + + if (result == null) { - // the variable item is a resource, you could call other operations on this instance as well + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - LongTermRetentionBackupData resourceData = item.Data; + LongTermRetentionBackupData resourceData = result.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - - Console.WriteLine($"Succeeded"); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupResource.cs index f11ca00efc264..c4e483cd75fbe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupResource.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_ResourceGroupLongTermRetentionBackupResource { - // Copy the long term retention backup. + // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CopyByResourceGroup_CopyTheLongTermRetentionBackup() + public async Task Get_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupCopy.json - // this example is just showing the usage of "LongTermRetentionBackups_CopyByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionBackups_GetByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -38,30 +38,27 @@ public async Task CopyByResourceGroup_CopyTheLongTermRetentionBackup() AzureLocation locationName = new AzureLocation("japaneast"); string longTermRetentionServerName = "testserver"; string longTermRetentionDatabaseName = "testDatabase"; - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; ResourceIdentifier resourceGroupLongTermRetentionBackupResourceId = ResourceGroupLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); ResourceGroupLongTermRetentionBackupResource resourceGroupLongTermRetentionBackup = client.GetResourceGroupLongTermRetentionBackupResource(resourceGroupLongTermRetentionBackupResourceId); // invoke the operation - CopyLongTermRetentionBackupContent content = new CopyLongTermRetentionBackupContent() - { - TargetServerResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2"), - TargetDatabaseName = "testDatabase2", - TargetBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, - }; - ArmOperation lro = await resourceGroupLongTermRetentionBackup.CopyByResourceGroupAsync(WaitUntil.Completed, content); - LongTermRetentionBackupOperationResult result = lro.Value; + ResourceGroupLongTermRetentionBackupResource result = await resourceGroupLongTermRetentionBackup.GetAsync(); - Console.WriteLine($"Succeeded: {result}"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // Update the long term retention backup. + // Delete the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task UpdateByResourceGroup_UpdateTheLongTermRetentionBackup() + public async Task Delete_DeleteTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupUpdate.json - // this example is just showing the usage of "LongTermRetentionBackups_UpdateByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupDelete.json + // this example is just showing the usage of "LongTermRetentionBackups_DeleteByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -75,28 +72,23 @@ public async Task UpdateByResourceGroup_UpdateTheLongTermRetentionBackup() AzureLocation locationName = new AzureLocation("japaneast"); string longTermRetentionServerName = "testserver"; string longTermRetentionDatabaseName = "testDatabase"; - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; ResourceIdentifier resourceGroupLongTermRetentionBackupResourceId = ResourceGroupLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); ResourceGroupLongTermRetentionBackupResource resourceGroupLongTermRetentionBackup = client.GetResourceGroupLongTermRetentionBackupResource(resourceGroupLongTermRetentionBackupResourceId); // invoke the operation - UpdateLongTermRetentionBackupContent content = new UpdateLongTermRetentionBackupContent() - { - RequestedBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, - }; - ArmOperation lro = await resourceGroupLongTermRetentionBackup.UpdateByResourceGroupAsync(WaitUntil.Completed, content); - LongTermRetentionBackupOperationResult result = lro.Value; + await resourceGroupLongTermRetentionBackup.DeleteAsync(WaitUntil.Completed); - Console.WriteLine($"Succeeded: {result}"); + Console.WriteLine($"Succeeded"); } - // Get the long term retention backup. + // Change the long term retention backup storage access tier for a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetTheLongTermRetentionBackup() + public async Task ChangeAccessTierByResourceGroup_ChangeTheLongTermRetentionBackupStorageAccessTierForAResourceGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json - // this example is just showing the usage of "LongTermRetentionBackups_GetByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedChangeLongTermRetentionBackupAccessTier.json + // this example is just showing the usage of "LongTermRetentionBackups_ChangeAccessTierByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -106,16 +98,18 @@ public async Task Get_GetTheLongTermRetentionBackup() // this example assumes you already have this ResourceGroupLongTermRetentionBackupResource created on azure // for more information of creating ResourceGroupLongTermRetentionBackupResource, please refer to the document of ResourceGroupLongTermRetentionBackupResource string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "testResourceGroup"; + string resourceGroupName = "resourceGroupName"; AzureLocation locationName = new AzureLocation("japaneast"); - string longTermRetentionServerName = "testserver"; - string longTermRetentionDatabaseName = "testDatabase"; - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + string longTermRetentionServerName = "serverName"; + string longTermRetentionDatabaseName = "databaseName"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; ResourceIdentifier resourceGroupLongTermRetentionBackupResourceId = ResourceGroupLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); ResourceGroupLongTermRetentionBackupResource resourceGroupLongTermRetentionBackup = client.GetResourceGroupLongTermRetentionBackupResource(resourceGroupLongTermRetentionBackupResourceId); // invoke the operation - ResourceGroupLongTermRetentionBackupResource result = await resourceGroupLongTermRetentionBackup.GetAsync(); + ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters = new ChangeLongTermRetentionBackupAccessTierParameters("Hot", "Copy"); + ArmOperation lro = await resourceGroupLongTermRetentionBackup.ChangeAccessTierByResourceGroupAsync(WaitUntil.Completed, changeLongTermRetentionBackupAccessTierParameters); + ResourceGroupLongTermRetentionBackupResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -124,13 +118,13 @@ public async Task Get_GetTheLongTermRetentionBackup() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // Delete the long term retention backup. + // Copy the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_DeleteTheLongTermRetentionBackup() + public async Task CopyByResourceGroup_CopyTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupDelete.json - // this example is just showing the usage of "LongTermRetentionBackups_DeleteByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupCopy.json + // this example is just showing the usage of "LongTermRetentionBackups_CopyByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -149,9 +143,51 @@ public async Task Delete_DeleteTheLongTermRetentionBackup() ResourceGroupLongTermRetentionBackupResource resourceGroupLongTermRetentionBackup = client.GetResourceGroupLongTermRetentionBackupResource(resourceGroupLongTermRetentionBackupResourceId); // invoke the operation - await resourceGroupLongTermRetentionBackup.DeleteAsync(WaitUntil.Completed); + CopyLongTermRetentionBackupContent content = new CopyLongTermRetentionBackupContent() + { + TargetServerResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2"), + TargetDatabaseName = "testDatabase2", + TargetBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, + }; + ArmOperation lro = await resourceGroupLongTermRetentionBackup.CopyByResourceGroupAsync(WaitUntil.Completed, content); + LongTermRetentionBackupOperationResult result = lro.Value; - Console.WriteLine($"Succeeded"); + Console.WriteLine($"Succeeded: {result}"); + } + + // Update the long term retention backup. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateByResourceGroup_UpdateTheLongTermRetentionBackup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupUpdate.json + // this example is just showing the usage of "LongTermRetentionBackups_UpdateByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupLongTermRetentionBackupResource created on azure + // for more information of creating ResourceGroupLongTermRetentionBackupResource, please refer to the document of ResourceGroupLongTermRetentionBackupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testResourceGroup"; + AzureLocation locationName = new AzureLocation("japaneast"); + string longTermRetentionServerName = "testserver"; + string longTermRetentionDatabaseName = "testDatabase"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + ResourceIdentifier resourceGroupLongTermRetentionBackupResourceId = ResourceGroupLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + ResourceGroupLongTermRetentionBackupResource resourceGroupLongTermRetentionBackup = client.GetResourceGroupLongTermRetentionBackupResource(resourceGroupLongTermRetentionBackupResourceId); + + // invoke the operation + UpdateLongTermRetentionBackupContent content = new UpdateLongTermRetentionBackupContent() + { + RequestedBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, + }; + ArmOperation lro = await resourceGroupLongTermRetentionBackup.UpdateByResourceGroupAsync(WaitUntil.Completed, content); + LongTermRetentionBackupOperationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs index 01d55cdaeecf1..cb1d656ab1ffe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -17,13 +17,13 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_ResourceGroupResourceExtensions { - // Get all long term retention backups under the location. + // Get all long term retention backups under the managed instance. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() + public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllLongTermRetentionBackupsUnderTheManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByLocation.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByResourceGroupLocation" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByInstance.json + // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -39,7 +39,8 @@ public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentio // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - await foreach (LongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionBackupsWithLocationAsync(locationName)) + string managedInstanceName = "testInstance"; + await foreach (ManagedInstanceLongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); @@ -48,13 +49,13 @@ public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentio Console.WriteLine($"Succeeded"); } - // Get all long term retention backups under the server. + // Get all long term retention backups under the location. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionBackupsUnderTheServer() + public async Task GetLongTermRetentionManagedInstanceBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByServer.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByResourceGroupServer" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByLocation.json + // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -70,8 +71,7 @@ public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionB // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - string longTermRetentionServerName = "testserver"; - await foreach (LongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName)) + await foreach (ManagedInstanceLongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); @@ -80,13 +80,13 @@ public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionB Console.WriteLine($"Succeeded"); } - // Get all long term retention backups under the managed instance. + // Get all long term retention backups under the location based on resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllLongTermRetentionBackupsUnderTheManagedInstance() + public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocationBasedOnResourceGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByInstance.json - // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByLocation.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByResourceGroupLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -102,8 +102,7 @@ public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllL // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - string managedInstanceName = "testInstance"; - await foreach (ManagedInstanceLongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName)) + await foreach (LongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionBackupsWithLocationAsync(locationName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); @@ -112,13 +111,13 @@ public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllL Console.WriteLine($"Succeeded"); } - // Get all long term retention backups under the location. + // Get all long term retention backups under the server based on resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionManagedInstanceBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() + public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionBackupsUnderTheServerBasedOnResourceGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByLocation.json - // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByServer.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByResourceGroupServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -134,7 +133,8 @@ public async Task GetLongTermRetentionManagedInstanceBackupsWithLocation_GetAllL // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - await foreach (ManagedInstanceLongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName)) + string longTermRetentionServerName = "testserver"; + await foreach (LongTermRetentionBackupData item in resourceGroupResource.GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs index f58bef73e408f..ca2f69766ec35 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_SubscriptionLongTermRetentionBackupCollection { - // Get the long term retention backup. + // Get all long term retention backups under the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetTheLongTermRetentionBackup() + public async Task GetAll_GetAllLongTermRetentionBackupsUnderTheDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json - // this example is just showing the usage of "LongTermRetentionBackups_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupListByDatabase.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByDatabase" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -43,23 +43,25 @@ public async Task Get_GetTheLongTermRetentionBackup() string longTermRetentionDatabaseName = "testDatabase"; SubscriptionLongTermRetentionBackupCollection collection = subscriptionResource.GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - // invoke the operation - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; - SubscriptionLongTermRetentionBackupResource result = await collection.GetAsync(backupName); + // invoke the operation and iterate over the result + await foreach (SubscriptionLongTermRetentionBackupResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LongTermRetentionBackupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - LongTermRetentionBackupData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_GetTheLongTermRetentionBackup() + public async Task Get_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupGet.json // this example is just showing the usage of "LongTermRetentionBackups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,18 +82,22 @@ public async Task Exists_GetTheLongTermRetentionBackup() SubscriptionLongTermRetentionBackupCollection collection = subscriptionResource.GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); // invoke the operation - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; - bool result = await collection.ExistsAsync(backupName); + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; + SubscriptionLongTermRetentionBackupResource result = await collection.GetAsync(backupName); - Console.WriteLine($"Succeeded: {result}"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_GetTheLongTermRetentionBackup() + public async Task Exists_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupGet.json // this example is just showing the usage of "LongTermRetentionBackups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -112,31 +118,19 @@ public async Task GetIfExists_GetTheLongTermRetentionBackup() SubscriptionLongTermRetentionBackupCollection collection = subscriptionResource.GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); // invoke the operation - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; - NullableResponse response = await collection.GetIfExistsAsync(backupName); - SubscriptionLongTermRetentionBackupResource result = response.HasValue ? response.Value : null; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; + bool result = await collection.ExistsAsync(backupName); - if (result == null) - { - Console.WriteLine($"Succeeded with null as result"); - } - else - { - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - LongTermRetentionBackupData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + Console.WriteLine($"Succeeded: {result}"); } - // Get all long term retention backups under the database. + // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GetAllLongTermRetentionBackupsUnderTheDatabase() + public async Task GetIfExists_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByDatabase.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByDatabase" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionBackups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -155,17 +149,23 @@ public async Task GetAll_GetAllLongTermRetentionBackupsUnderTheDatabase() string longTermRetentionDatabaseName = "testDatabase"; SubscriptionLongTermRetentionBackupCollection collection = subscriptionResource.GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - // invoke the operation and iterate over the result - await foreach (SubscriptionLongTermRetentionBackupResource item in collection.GetAllAsync()) + // invoke the operation + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + SubscriptionLongTermRetentionBackupResource result = response.HasValue ? response.Value : null; + + if (result == null) { - // the variable item is a resource, you could call other operations on this instance as well + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - LongTermRetentionBackupData resourceData = item.Data; + LongTermRetentionBackupData resourceData = result.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - - Console.WriteLine($"Succeeded"); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupResource.cs index 6e662e51a4ed3..185e29e048ada 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupResource.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_SubscriptionLongTermRetentionBackupResource { - // Copy the long term retention backup. + // Get the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Copy_CopyTheLongTermRetentionBackup() + public async Task Get_GetTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupCopy.json - // this example is just showing the usage of "LongTermRetentionBackups_Copy" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionBackups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -37,30 +37,27 @@ public async Task Copy_CopyTheLongTermRetentionBackup() AzureLocation locationName = new AzureLocation("japaneast"); string longTermRetentionServerName = "testserver"; string longTermRetentionDatabaseName = "testDatabase"; - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; ResourceIdentifier subscriptionLongTermRetentionBackupResourceId = SubscriptionLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); SubscriptionLongTermRetentionBackupResource subscriptionLongTermRetentionBackup = client.GetSubscriptionLongTermRetentionBackupResource(subscriptionLongTermRetentionBackupResourceId); // invoke the operation - CopyLongTermRetentionBackupContent content = new CopyLongTermRetentionBackupContent() - { - TargetServerResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2"), - TargetDatabaseName = "testDatabase2", - TargetBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, - }; - ArmOperation lro = await subscriptionLongTermRetentionBackup.CopyAsync(WaitUntil.Completed, content); - LongTermRetentionBackupOperationResult result = lro.Value; + SubscriptionLongTermRetentionBackupResource result = await subscriptionLongTermRetentionBackup.GetAsync(); - Console.WriteLine($"Succeeded: {result}"); + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // Update the long term retention backup. + // Delete the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_UpdateTheLongTermRetentionBackup() + public async Task Delete_DeleteTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupUpdate.json - // this example is just showing the usage of "LongTermRetentionBackups_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupDelete.json + // this example is just showing the usage of "LongTermRetentionBackups_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -73,28 +70,23 @@ public async Task Update_UpdateTheLongTermRetentionBackup() AzureLocation locationName = new AzureLocation("japaneast"); string longTermRetentionServerName = "testserver"; string longTermRetentionDatabaseName = "testDatabase"; - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Hot"; ResourceIdentifier subscriptionLongTermRetentionBackupResourceId = SubscriptionLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); SubscriptionLongTermRetentionBackupResource subscriptionLongTermRetentionBackup = client.GetSubscriptionLongTermRetentionBackupResource(subscriptionLongTermRetentionBackupResourceId); // invoke the operation - UpdateLongTermRetentionBackupContent content = new UpdateLongTermRetentionBackupContent() - { - RequestedBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, - }; - ArmOperation lro = await subscriptionLongTermRetentionBackup.UpdateAsync(WaitUntil.Completed, content); - LongTermRetentionBackupOperationResult result = lro.Value; + await subscriptionLongTermRetentionBackup.DeleteAsync(WaitUntil.Completed); - Console.WriteLine($"Succeeded: {result}"); + Console.WriteLine($"Succeeded"); } - // Get the long term retention backup. + // Change the long term retention backup storage access tier. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetTheLongTermRetentionBackup() + public async Task ChangeAccessTier_ChangeTheLongTermRetentionBackupStorageAccessTier() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json - // this example is just showing the usage of "LongTermRetentionBackups_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ChangeLongTermRetentionBackupAccessTier.json + // this example is just showing the usage of "LongTermRetentionBackups_ChangeAccessTier" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -105,14 +97,16 @@ public async Task Get_GetTheLongTermRetentionBackup() // for more information of creating SubscriptionLongTermRetentionBackupResource, please refer to the document of SubscriptionLongTermRetentionBackupResource string subscriptionId = "00000000-1111-2222-3333-444444444444"; AzureLocation locationName = new AzureLocation("japaneast"); - string longTermRetentionServerName = "testserver"; - string longTermRetentionDatabaseName = "testDatabase"; - string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + string longTermRetentionServerName = "serverName"; + string longTermRetentionDatabaseName = "databaseName"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000;Archive"; ResourceIdentifier subscriptionLongTermRetentionBackupResourceId = SubscriptionLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); SubscriptionLongTermRetentionBackupResource subscriptionLongTermRetentionBackup = client.GetSubscriptionLongTermRetentionBackupResource(subscriptionLongTermRetentionBackupResourceId); // invoke the operation - SubscriptionLongTermRetentionBackupResource result = await subscriptionLongTermRetentionBackup.GetAsync(); + ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters = new ChangeLongTermRetentionBackupAccessTierParameters("Hot", "Copy"); + ArmOperation lro = await subscriptionLongTermRetentionBackup.ChangeAccessTierAsync(WaitUntil.Completed, changeLongTermRetentionBackupAccessTierParameters); + SubscriptionLongTermRetentionBackupResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -121,13 +115,13 @@ public async Task Get_GetTheLongTermRetentionBackup() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // Delete the long term retention backup. + // Copy the long term retention backup. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_DeleteTheLongTermRetentionBackup() + public async Task Copy_CopyTheLongTermRetentionBackup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupDelete.json - // this example is just showing the usage of "LongTermRetentionBackups_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupCopy.json + // this example is just showing the usage of "LongTermRetentionBackups_Copy" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -145,9 +139,50 @@ public async Task Delete_DeleteTheLongTermRetentionBackup() SubscriptionLongTermRetentionBackupResource subscriptionLongTermRetentionBackup = client.GetSubscriptionLongTermRetentionBackupResource(subscriptionLongTermRetentionBackupResourceId); // invoke the operation - await subscriptionLongTermRetentionBackup.DeleteAsync(WaitUntil.Completed); + CopyLongTermRetentionBackupContent content = new CopyLongTermRetentionBackupContent() + { + TargetServerResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2"), + TargetDatabaseName = "testDatabase2", + TargetBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, + }; + ArmOperation lro = await subscriptionLongTermRetentionBackup.CopyAsync(WaitUntil.Completed, content); + LongTermRetentionBackupOperationResult result = lro.Value; - Console.WriteLine($"Succeeded"); + Console.WriteLine($"Succeeded: {result}"); + } + + // Update the long term retention backup. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTheLongTermRetentionBackup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupUpdate.json + // this example is just showing the usage of "LongTermRetentionBackups_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionLongTermRetentionBackupResource created on azure + // for more information of creating SubscriptionLongTermRetentionBackupResource, please refer to the document of SubscriptionLongTermRetentionBackupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + AzureLocation locationName = new AzureLocation("japaneast"); + string longTermRetentionServerName = "testserver"; + string longTermRetentionDatabaseName = "testDatabase"; + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + ResourceIdentifier subscriptionLongTermRetentionBackupResourceId = SubscriptionLongTermRetentionBackupResource.CreateResourceIdentifier(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + SubscriptionLongTermRetentionBackupResource subscriptionLongTermRetentionBackup = client.GetSubscriptionLongTermRetentionBackupResource(subscriptionLongTermRetentionBackupResourceId); + + // invoke the operation + UpdateLongTermRetentionBackupContent content = new UpdateLongTermRetentionBackupContent() + { + RequestedBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, + }; + ArmOperation lro = await subscriptionLongTermRetentionBackup.UpdateAsync(WaitUntil.Completed, content); + LongTermRetentionBackupOperationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 174a16f08e75c..88539642176ab 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -44,13 +44,13 @@ public async Task GetCapabilitiesByLocation_ListSubscriptionCapabilitiesInTheGiv Console.WriteLine($"Succeeded: {result}"); } - // Get all long term retention backups under the location. + // Get all long term retention backups under the managed instance. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() + public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllLongTermRetentionBackupsUnderTheManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByLocation.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByLocation" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByInstance.json + // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByInstance" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -65,7 +65,8 @@ public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentio // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithLocationAsync(locationName)) + string managedInstanceName = "testInstance"; + await foreach (ManagedInstanceLongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); @@ -74,13 +75,13 @@ public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentio Console.WriteLine($"Succeeded"); } - // Get all long term retention backups under the server. + // Get all long term retention backups under the location. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionBackupsUnderTheServer() + public async Task GetLongTermRetentionManagedInstanceBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByServer.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByServer" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByLocation.json + // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -95,8 +96,7 @@ public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionB // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - string longTermRetentionServerName = "testserver"; - await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName)) + await foreach (ManagedInstanceLongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); @@ -105,13 +105,13 @@ public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionB Console.WriteLine($"Succeeded"); } - // Get all long term retention backups under the managed instance. + // Get all long term retention backups under the location. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllLongTermRetentionBackupsUnderTheManagedInstance() + public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByInstance.json - // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByInstance" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupListByLocation.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -126,8 +126,7 @@ public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllL // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - string managedInstanceName = "testInstance"; - await foreach (ManagedInstanceLongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName)) + await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithLocationAsync(locationName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); @@ -136,13 +135,13 @@ public async Task GetLongTermRetentionManagedInstanceBackupsWithInstance_GetAllL Console.WriteLine($"Succeeded"); } - // Get all long term retention backups under the location. + // Get all long term retention backups under the server. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetLongTermRetentionManagedInstanceBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() + public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionBackupsUnderTheServer() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByLocation.json - // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_ListByLocation" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupListByServer.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -157,7 +156,8 @@ public async Task GetLongTermRetentionManagedInstanceBackupsWithLocation_GetAllL // invoke the operation and iterate over the result AzureLocation locationName = new AzureLocation("japaneast"); - await foreach (ManagedInstanceLongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName)) + string longTermRetentionServerName = "testserver"; + await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName)) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs index b7c9c8ef75828..c24f4d2679522 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs @@ -615,25 +615,6 @@ public static ResourceWithWritableName ResourceWithWritableName(ResourceIdentifi return new ResourceWithWritableName(id, name, resourceType); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The name and tier of the SKU. - /// Resource ID of the subnet to place this instance pool in. - /// Count of vCores belonging to this instance pool. - /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). - /// A new instance for mocking. - public static InstancePoolData InstancePoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null) - { - tags ??= new Dictionary(); - - return new InstancePoolData(id, name, resourceType, systemData, tags, location, sku, subnetId, vCores, licenseType); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -699,6 +680,19 @@ public static JobExecutionTarget JobExecutionTarget(JobTargetType? targetType = return new JobExecutionTarget(targetType, serverName, databaseName); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ARM resource id of the server the private endpoint will target. + /// Private endpoint id of the private endpoint. + /// A new instance for mocking. + public static JobPrivateEndpointData JobPrivateEndpointData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier targetServerAzureResourceId = null, string privateEndpointId = null) + { + return new JobPrivateEndpointData(id, name, resourceType, systemData, targetServerAzureResourceId, privateEndpointId); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -1112,21 +1106,6 @@ public static InstancePoolVcoresCapability InstancePoolVcoresCapability(string n return new InstancePoolVcoresCapability(name, value, storageLimit, status, reason); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The weekly retention policy for an LTR backup in an ISO 8601 format. - /// The monthly retention policy for an LTR backup in an ISO 8601 format. - /// The yearly retention policy for an LTR backup in an ISO 8601 format. - /// The week of year to take the yearly backup in an ISO 8601 format. - /// A new instance for mocking. - public static LongTermRetentionPolicyData LongTermRetentionPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string weeklyRetention = null, string monthlyRetention = null, string yearlyRetention = null, int? weekOfYear = null) - { - return new LongTermRetentionPolicyData(id, name, resourceType, systemData, weeklyRetention, monthlyRetention, yearlyRetention, weekOfYear); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -2220,43 +2199,6 @@ public static InstancePoolUsageName InstancePoolUsageName(string value = null, s return new InstancePoolUsageName(value, localizedValue); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Request Id. - /// Operation type. - /// Source backup resource id. - /// Target backup resource id. - /// The storage redundancy type of the copied backup. - /// Operation status. - /// Progress message. - /// A new instance for mocking. - public static LongTermRetentionBackupOperationResult LongTermRetentionBackupOperationResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? requestId = null, string operationType = null, ResourceIdentifier fromBackupResourceId = null, ResourceIdentifier toBackupResourceId = null, SqlBackupStorageRedundancy? targetBackupStorageRedundancy = null, string status = null, string message = null) - { - return new LongTermRetentionBackupOperationResult(id, name, resourceType, systemData, requestId, operationType, fromBackupResourceId, toBackupResourceId, targetBackupStorageRedundancy, status, message); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The server name that the backup database belong to. - /// The create time of the server. - /// The name of the database the backup belong to. - /// The delete time of the database. - /// The time the backup was taken. - /// The time the long term retention backup will expire. - /// The storage redundancy type of the backup. - /// The storage redundancy type of the backup. - /// A new instance for mocking. - public static LongTermRetentionBackupData LongTermRetentionBackupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string serverName = null, DateTimeOffset? serverCreateOn = null, string databaseName = null, DateTimeOffset? databaseDeletedOn = null, DateTimeOffset? backupOn = null, DateTimeOffset? backupExpireOn = null, SqlBackupStorageRedundancy? backupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null) - { - return new LongTermRetentionBackupData(id, name, resourceType, systemData, serverName, serverCreateOn, databaseName, databaseDeletedOn, backupOn, backupExpireOn, backupStorageRedundancy, requestedBackupStorageRedundancy); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -3919,5 +3861,82 @@ public static PartnerServerInfo PartnerServerInfo(ResourceIdentifier id = null, { return new PartnerServerInfo(id, location, replicationRole); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The name and tier of the SKU. + /// Resource ID of the subnet to place this instance pool in. + /// Count of vCores belonging to this instance pool. + /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). + /// The Dns Zone that the managed instance pool is in. + /// Specifies maintenance configuration id to apply to this managed instance. + /// A new instance for mocking. + public static InstancePoolData InstancePoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null, string dnsZone = null, ResourceIdentifier maintenanceConfigurationId = null) + { + tags ??= new Dictionary(); + + return new InstancePoolData(id, name, resourceType, systemData, tags, location, sku, subnetId, vCores, licenseType, dnsZone, maintenanceConfigurationId); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The server name that the backup database belong to. + /// The create time of the server. + /// The name of the database the backup belong to. + /// The delete time of the database. + /// The time the backup was taken. + /// The time the long term retention backup will expire. + /// The storage redundancy type of the backup. + /// The storage redundancy type of the backup. + /// The setting whether the LTR backup is immutable. + /// The BackupStorageAccessTier for the LTR backup. + /// A new instance for mocking. + public static LongTermRetentionBackupData LongTermRetentionBackupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string serverName = null, DateTimeOffset? serverCreateOn = null, string databaseName = null, DateTimeOffset? databaseDeletedOn = null, DateTimeOffset? backupOn = null, DateTimeOffset? backupExpireOn = null, SqlBackupStorageRedundancy? backupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null, bool? isBackupImmutable = null, BackupStorageAccessTier? backupStorageAccessTier = null) + { + return new LongTermRetentionBackupData(id, name, resourceType, systemData, serverName, serverCreateOn, databaseName, databaseDeletedOn, backupOn, backupExpireOn, backupStorageRedundancy, requestedBackupStorageRedundancy, isBackupImmutable, backupStorageAccessTier); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Request Id. + /// Operation type. + /// Source backup resource id. + /// Target backup resource id. + /// The storage redundancy type of the copied backup. + /// Operation status. + /// Progress message. + /// A new instance for mocking. + public static LongTermRetentionBackupOperationResult LongTermRetentionBackupOperationResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? requestId = null, string operationType = null, ResourceIdentifier fromBackupResourceId = null, ResourceIdentifier toBackupResourceId = null, SqlBackupStorageRedundancy? targetBackupStorageRedundancy = null, string status = null, string message = null) + { + return new LongTermRetentionBackupOperationResult(id, name, resourceType, systemData, requestId, operationType, fromBackupResourceId, toBackupResourceId, targetBackupStorageRedundancy, status, message); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The setting whether to make LTR backups immutable. + /// The BackupStorageAccessTier for the LTR backups. + /// The weekly retention policy for an LTR backup in an ISO 8601 format. + /// The monthly retention policy for an LTR backup in an ISO 8601 format. + /// The yearly retention policy for an LTR backup in an ISO 8601 format. + /// The week of year to take the yearly backup in an ISO 8601 format. + /// A new instance for mocking. + public static LongTermRetentionPolicyData LongTermRetentionPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? makeBackupsImmutable = null, BackupStorageAccessTier? backupStorageAccessTier = null, string weeklyRetention = null, string monthlyRetention = null, string yearlyRetention = null, int? weekOfYear = null) + { + return new LongTermRetentionPolicyData(id, name, resourceType, systemData, makeBackupsImmutable, backupStorageAccessTier, weeklyRetention, monthlyRetention, yearlyRetention, weekOfYear); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs index 2a18662caadf0..1974a18af041a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs @@ -336,18 +336,6 @@ public virtual SqlFirewallRuleResource GetSqlFirewallRuleResource(ResourceIdenti return new SqlFirewallRuleResource(Client, id); } - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual InstancePoolResource GetInstancePoolResource(ResourceIdentifier id) - { - InstancePoolResource.ValidateResourceId(id); - return new InstancePoolResource(Client, id); - } - /// /// 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. @@ -408,6 +396,18 @@ public virtual SqlServerJobExecutionStepTargetResource GetSqlServerJobExecutionS return new SqlServerJobExecutionStepTargetResource(Client, id); } + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual JobPrivateEndpointResource GetJobPrivateEndpointResource(ResourceIdentifier id) + { + JobPrivateEndpointResource.ValidateResourceId(id); + return new JobPrivateEndpointResource(Client, id); + } + /// /// 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. @@ -468,18 +468,6 @@ public virtual SqlServerJobVersionResource GetSqlServerJobVersionResource(Resour return new SqlServerJobVersionResource(Client, id); } - /// - /// 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 resource ID of the resource to get. - /// Returns a object. - public virtual LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(ResourceIdentifier id) - { - LongTermRetentionPolicyResource.ValidateResourceId(id); - return new LongTermRetentionPolicyResource(Client, id); - } - /// /// 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. @@ -972,30 +960,6 @@ public virtual OutboundFirewallRuleResource GetOutboundFirewallRuleResource(Reso return new OutboundFirewallRuleResource(Client, id); } - /// - /// 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 resource ID of the resource to get. - /// Returns a object. - public virtual SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(ResourceIdentifier id) - { - SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); - return new SubscriptionLongTermRetentionBackupResource(Client, id); - } - - /// - /// 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 resource ID of the resource to get. - /// Returns a object. - public virtual ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(ResourceIdentifier id) - { - ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionBackupResource(Client, id); - } - /// /// 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. @@ -1547,5 +1511,53 @@ public virtual FailoverGroupResource GetFailoverGroupResource(ResourceIdentifier FailoverGroupResource.ValidateResourceId(id); return new FailoverGroupResource(Client, id); } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual InstancePoolResource GetInstancePoolResource(ResourceIdentifier id) + { + InstancePoolResource.ValidateResourceId(id); + return new InstancePoolResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(ResourceIdentifier id) + { + SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); + return new SubscriptionLongTermRetentionBackupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(ResourceIdentifier id) + { + ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionBackupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(ResourceIdentifier id) + { + LongTermRetentionPolicyResource.ValidateResourceId(id); + return new LongTermRetentionPolicyResource(Client, id); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs index ded4e3b6573a3..117f1c7080ff5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs @@ -21,10 +21,10 @@ namespace Azure.ResourceManager.Sql.Mocking /// A class to add extension methods to ResourceGroupResource. public partial class MockableSqlResourceGroupResource : ArmResource { - private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; - private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; + private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; + private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; /// Initializes a new instance of the class for mocking. protected MockableSqlResourceGroupResource() @@ -38,10 +38,10 @@ internal MockableSqlResourceGroupResource(ArmClient client, ResourceIdentifier i { } - 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 LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -49,59 +49,6 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. - /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. - public virtual InstancePoolCollection GetInstancePools() - { - return GetCachedClient(client => new InstancePoolCollection(client, Id)); - } - - /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// - /// - /// Operation Id - /// InstancePools_Get - /// - /// - /// - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetInstancePoolAsync(string instancePoolName, CancellationToken cancellationToken = default) - { - return await GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// - /// - /// Operation Id - /// InstancePools_Get - /// - /// - /// - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetInstancePool(string instancePoolName, CancellationToken cancellationToken = default) - { - return GetInstancePools().Get(instancePoolName, cancellationToken); - } - /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. /// The name of the region where the resource is located. /// An object representing collection of SqlServerTrustGroupResources and their operations over a SqlServerTrustGroupResource. @@ -158,70 +105,6 @@ public virtual Response GetSqlServerTrustGroup(Azur return GetSqlServerTrustGroups(locationName).Get(serverTrustGroupName, cancellationToken); } - /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. - public virtual ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) - { - return new ResourceGroupLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - } - - /// - /// Gets a long term retention backup. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionBackups_GetByResourceGroup - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetResourceGroupLongTermRetentionBackupAsync(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) - { - return await GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a long term retention backup. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionBackups_GetByResourceGroup - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetResourceGroupLongTermRetentionBackup(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) - { - return GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); - } - /// Gets a collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources in the ResourceGroupResource. /// The location of the database. /// The name of the managed instance. @@ -505,114 +388,121 @@ public virtual Response GetSqlServer(string serverName, strin return GetSqlServers().Get(serverName, expand, cancellationToken); } + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public virtual InstancePoolCollection GetInstancePools() + { + return GetCachedClient(client => new InstancePoolCollection(client, Id)); + } + /// - /// Lists the long term retention backups for a given location. + /// Gets an instance pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupLocation + /// InstancePools_Get /// /// /// - /// 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 instance pool to be retrieved. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInstancePoolAsync(string instancePoolName, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + return await GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); } /// - /// Lists the long term retention backups for a given location. + /// Gets an instance pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupLocation + /// InstancePools_Get /// /// /// - /// 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 instance pool to be retrieved. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInstancePool(string instancePoolName, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + return GetInstancePools().Get(instancePoolName, cancellationToken); + } + + /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. + public virtual ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) + { + return new ResourceGroupLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); } /// - /// Lists the long term retention backups for a given server. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupServer + /// LongTermRetentionBackups_GetByResourceGroup /// /// /// /// 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 name of the database. + /// The backup name. /// 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 virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceGroupLongTermRetentionBackupAsync(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + return await GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); } /// - /// Lists the long term retention backups for a given server. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupServer + /// LongTermRetentionBackups_GetByResourceGroup /// /// /// /// 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 name of the database. + /// The backup name. /// 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 virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceGroupLongTermRetentionBackup(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + return GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); } /// @@ -724,5 +614,115 @@ public virtual Pageable GetLongTermR HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); } + + /// + /// Lists the long term retention backups for a given location based on resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupLocation + /// + /// + /// + /// 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 GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location based on resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupLocation + /// + /// + /// + /// 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 GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server based on resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is 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 virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server based on resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is 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 virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs index fb3cc4e5c4106..93c1198502907 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs @@ -25,14 +25,10 @@ public partial class MockableSqlSubscriptionResource : ArmResource { private ClientDiagnostics _deletedServerClientDiagnostics; private DeletedServersRestOperations _deletedServerRestClient; - private ClientDiagnostics _instancePoolClientDiagnostics; - private InstancePoolsRestOperations _instancePoolRestClient; private ClientDiagnostics _capabilitiesClientDiagnostics; private CapabilitiesRestOperations _capabilitiesRestClient; private ClientDiagnostics _syncGroupClientDiagnostics; private SyncGroupsRestOperations _syncGroupRestClient; - private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; - private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; private ClientDiagnostics _virtualClusterClientDiagnostics; @@ -41,6 +37,10 @@ public partial class MockableSqlSubscriptionResource : ArmResource private ManagedInstancesRestOperations _managedInstanceRestClient; private ClientDiagnostics _sqlServerServersClientDiagnostics; private ServersRestOperations _sqlServerServersRestClient; + private ClientDiagnostics _instancePoolClientDiagnostics; + private InstancePoolsRestOperations _instancePoolRestClient; + private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; + private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; /// Initializes a new instance of the class for mocking. protected MockableSqlSubscriptionResource() @@ -56,14 +56,10 @@ internal MockableSqlSubscriptionResource(ArmClient client, ResourceIdentifier id private ClientDiagnostics DeletedServerClientDiagnostics => _deletedServerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", DeletedServerResource.ResourceType.Namespace, Diagnostics); private DeletedServersRestOperations DeletedServerRestClient => _deletedServerRestClient ??= new DeletedServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedServerResource.ResourceType)); - private ClientDiagnostics InstancePoolClientDiagnostics => _instancePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", InstancePoolResource.ResourceType.Namespace, Diagnostics); - 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 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 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 VirtualClusterClientDiagnostics => _virtualClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", VirtualClusterResource.ResourceType.Namespace, Diagnostics); @@ -72,6 +68,10 @@ internal MockableSqlSubscriptionResource(ArmClient client, ResourceIdentifier id private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.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 InstancePoolClientDiagnostics => _instancePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", InstancePoolResource.ResourceType.Namespace, Diagnostics); + private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); + private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -247,70 +247,6 @@ public virtual Response GetSqlTimeZone(AzureLocation locati return GetSqlTimeZones(locationName).Get(timeZoneId, cancellationToken); } - /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// An object representing collection of SubscriptionLongTermRetentionBackupResources and their operations over a SubscriptionLongTermRetentionBackupResource. - public virtual SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) - { - return new SubscriptionLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - } - - /// - /// Gets a long term retention backup. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionBackups_Get - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetSubscriptionLongTermRetentionBackupAsync(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) - { - return await GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a long term retention backup. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionBackups_Get - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetSubscriptionLongTermRetentionBackup(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) - { - return GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); - } - /// Gets a collection of SubscriptionLongTermRetentionManagedInstanceBackupResources in the SubscriptionResource. /// The location of the database. /// The name of the managed instance. @@ -375,92 +311,112 @@ public virtual Response Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of SubscriptionLongTermRetentionBackupResources and their operations over a SubscriptionLongTermRetentionBackupResource. + public virtual SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) + { + return new SubscriptionLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + } + /// - /// Gets a list of all deleted servers in a subscription. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// DeletedServers_List + /// LongTermRetentionBackups_Get /// /// /// + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedServersAsync(CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionLongTermRetentionBackupAsync(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetDeletedServers", "value", "nextLink", cancellationToken); + return await GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a list of all deleted servers in a subscription. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// DeletedServers_List + /// LongTermRetentionBackups_Get /// /// /// + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedServers(CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionLongTermRetentionBackup(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetDeletedServers", "value", "nextLink", cancellationToken); + return GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); } /// - /// Gets a list of all instance pools in the subscription. + /// Gets a list of all deleted servers in a subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers /// /// /// Operation Id - /// InstancePools_List + /// DeletedServers_List /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetInstancePoolsAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedServersAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetDeletedServers", "value", "nextLink", cancellationToken); } /// - /// Gets a list of all instance pools in the subscription. + /// Gets a list of all deleted servers in a subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers /// /// /// Operation Id - /// InstancePools_List + /// DeletedServers_List /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetInstancePools(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedServers(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetDeletedServers", "value", "nextLink", cancellationToken); } /// @@ -573,116 +529,6 @@ public virtual Pageable GetSyncDatabaseIdsSyncGroups(AzureLocation return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), SyncGroupClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetSyncDatabaseIdsSyncGroups", "value", "nextLink", cancellationToken); } - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByLocation - /// - /// - /// - /// The 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 GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByLocation - /// - /// - /// - /// The 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 GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given server. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByServer - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// is 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 virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given server. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByServer - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// is 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 virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); - } - /// /// Lists the long term retention backups for a given managed instance. /// @@ -996,5 +842,159 @@ public virtual Pageable GetSqlServers(string expand = null, C HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlServerResource(Client, SqlServerData.DeserializeSqlServerData(e)), SqlServerServersClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetSqlServers", "value", "nextLink", cancellationToken); } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetInstancePoolsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetInstancePools(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByLocation + /// + /// + /// + /// The 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 GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByLocation + /// + /// + /// + /// The 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 GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is 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 virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is 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 virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } } } 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 e8bffd1401f06..7a7d21de969b3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -511,25 +511,6 @@ public static SqlFirewallRuleResource GetSqlFirewallRuleResource(this ArmClient return GetMockableSqlArmClient(client).GetSqlFirewallRuleResource(id); } - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static InstancePoolResource GetInstancePoolResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableSqlArmClient(client).GetInstancePoolResource(id); - } - /// /// 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. @@ -625,6 +606,25 @@ public static SqlServerJobExecutionStepTargetResource GetSqlServerJobExecutionSt return GetMockableSqlArmClient(client).GetSqlServerJobExecutionStepTargetResource(id); } + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static JobPrivateEndpointResource GetJobPrivateEndpointResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSqlArmClient(client).GetJobPrivateEndpointResource(id); + } + /// /// 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. @@ -720,25 +720,6 @@ public static SqlServerJobVersionResource GetSqlServerJobVersionResource(this Ar return GetMockableSqlArmClient(client).GetSqlServerJobVersionResource(id); } - /// - /// 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. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableSqlArmClient(client).GetLongTermRetentionPolicyResource(id); - } - /// /// 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. @@ -1518,44 +1499,6 @@ public static OutboundFirewallRuleResource GetOutboundFirewallRuleResource(this return GetMockableSqlArmClient(client).GetOutboundFirewallRuleResource(id); } - /// - /// 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. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableSqlArmClient(client).GetSubscriptionLongTermRetentionBackupResource(id); - } - - /// - /// 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. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableSqlArmClient(client).GetResourceGroupLongTermRetentionBackupResource(id); - } - /// /// 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. @@ -2431,80 +2374,79 @@ public static FailoverGroupResource GetFailoverGroupResource(this ArmClient clie } /// - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. - /// is null. - /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. - public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static InstancePoolResource GetInstancePoolResource(this ArmClient client, ResourceIdentifier id) { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + Argument.AssertNotNull(client, nameof(client)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePools(); + return GetMockableSqlArmClient(client).GetInstancePoolResource(id); } /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// - /// - /// Operation Id - /// InstancePools_Get - /// - /// + /// 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. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + Argument.AssertNotNull(client, nameof(client)); - return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePoolAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + return GetMockableSqlArmClient(client).GetSubscriptionLongTermRetentionBackupResource(id); } /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// + /// 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. /// - /// Operation Id - /// InstancePools_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSqlArmClient(client).GetResourceGroupLongTermRetentionBackupResource(id); + } + + /// + /// 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. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(this ArmClient client, ResourceIdentifier id) { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + Argument.AssertNotNull(client, nameof(client)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePool(instancePoolName, cancellationToken); + return GetMockableSqlArmClient(client).GetLongTermRetentionPolicyResource(id); } /// @@ -2588,190 +2530,103 @@ public static Response GetSqlServerTrustGroup(this } /// - /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. + /// Gets a collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of the database. - /// The name of the server. - /// The name of the database. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. - public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) + /// The name of the managed instance. + /// The name of the managed database. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources and their operations over a ResourceGroupLongTermRetentionManagedInstanceBackupResource. + public static ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetResourceGroupLongTermRetentionManagedInstanceBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); } /// - /// Gets a long term retention backup. + /// Gets a long term retention backup for a managed database. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} /// /// /// Operation Id - /// LongTermRetentionBackups_GetByResourceGroup + /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of the database. - /// The name of the server. - /// The name of the database. + /// The name of the managed instance. + /// The name of the managed database. /// The backup name. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetResourceGroupLongTermRetentionBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public static async Task> GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(locationName, managedInstanceName, databaseName, backupName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a long term retention backup. + /// Gets a long term retention backup for a managed database. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} /// /// /// Operation Id - /// LongTermRetentionBackups_GetByResourceGroup + /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of the database. - /// The name of the server. - /// The name of the database. + /// The name of the managed instance. + /// The name of the managed database. /// The backup name. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetResourceGroupLongTermRetentionBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public static Response GetResourceGroupLongTermRetentionManagedInstanceBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackup(locationName, managedInstanceName, databaseName, backupName, cancellationToken); } /// - /// Gets a collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources in the ResourceGroupResource. + /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// The name of the managed instance. - /// The name of the managed database. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// An object representing collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources and their operations over a ResourceGroupLongTermRetentionManagedInstanceBackupResource. - public static ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetResourceGroupLongTermRetentionManagedInstanceBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName) - { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); - } - - /// - /// Gets a long term retention backup for a managed database. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The location of the database. - /// The name of the managed instance. - /// The name of the managed database. - /// The backup name. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static async Task> GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - - return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(locationName, managedInstanceName, databaseName, backupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a long term retention backup for a managed database. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The location of the database. - /// The name of the managed instance. - /// The name of the managed database. - /// The backup name. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static Response GetResourceGroupLongTermRetentionManagedInstanceBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackup(locationName, managedInstanceName, databaseName, backupName, cancellationToken); - } - - /// - /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// is null. - /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. - public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupResource resourceGroupResource) + /// is null. + /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. + public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -3077,131 +2932,167 @@ public static Response GetSqlServer(this ResourceGroupResourc } /// - /// Lists the long term retention backups for a given location. + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePools(); + } + + /// + /// Gets an instance pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupLocation + /// InstancePools_Get /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePoolAsync(instancePoolName, cancellationToken).ConfigureAwait(false); } /// - /// Lists the long term retention backups for a given location. + /// Gets an instance pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupLocation + /// InstancePools_Get /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetLongTermRetentionBackupsWithLocation(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePool(instancePoolName, cancellationToken); } /// - /// Lists the long term retention backups for a given server. + /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. + public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + } + + /// + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupServer + /// LongTermRetentionBackups_GetByResourceGroup /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of the database. /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetLongTermRetentionBackupsWithServerAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetResourceGroupLongTermRetentionBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); } /// - /// Lists the long term retention backups for a given server. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupServer + /// LongTermRetentionBackups_GetByResourceGroup /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of the database. /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetLongTermRetentionBackupsWithServer(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetResourceGroupLongTermRetentionBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); } /// @@ -3333,69 +3224,197 @@ public static Pageable GetLongTermRe } /// - /// Gets a collection of DeletedServerResources in the SubscriptionResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// is null. - /// An object representing collection of DeletedServerResources and their operations over a DeletedServerResource. - public static DeletedServerCollection GetDeletedServers(this SubscriptionResource subscriptionResource, AzureLocation locationName) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServers(locationName); - } - - /// - /// Gets a deleted server. + /// Lists the long term retention backups for a given location based on resource group. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups /// /// /// Operation Id - /// DeletedServers_Get + /// LongTermRetentionBackups_ListByResourceGroupLocation /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The name of the deleted server. + /// The instance the method will execute against. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static async Task> GetDeletedServerAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string deletedServerName, CancellationToken cancellationToken = default) + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServerAsync(locationName, deletedServerName, cancellationToken).ConfigureAwait(false); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// - /// Gets a deleted server. + /// Lists the long term retention backups for a given location based on resource group. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups /// /// /// Operation Id - /// DeletedServers_Get + /// LongTermRetentionBackups_ListByResourceGroupLocation /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetLongTermRetentionBackupsWithLocation(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server based on resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupServer + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetLongTermRetentionBackupsWithServerAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server based on resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupServer + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetLongTermRetentionBackupsWithServer(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Gets a collection of DeletedServerResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// is null. + /// An object representing collection of DeletedServerResources and their operations over a DeletedServerResource. + public static DeletedServerCollection GetDeletedServers(this SubscriptionResource subscriptionResource, AzureLocation locationName) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServers(locationName); + } + + /// + /// Gets a deleted server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// + /// + /// Operation Id + /// DeletedServers_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDeletedServerAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServerAsync(locationName, deletedServerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deleted server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// + /// + /// Operation Id + /// DeletedServers_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -3572,93 +3591,6 @@ public static Response GetSqlTimeZone(this SubscriptionReso return GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlTimeZone(locationName, timeZoneId, cancellationToken); } - /// - /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// An object representing collection of SubscriptionLongTermRetentionBackupResources and their operations over a SubscriptionLongTermRetentionBackupResource. - public static SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - } - - /// - /// Gets a long term retention backup. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionBackups_Get - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static async Task> GetSubscriptionLongTermRetentionBackupAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return await GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a long term retention backup. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} - /// - /// - /// Operation Id - /// LongTermRetentionBackups_Get - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static Response GetSubscriptionLongTermRetentionBackup(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); - } - /// /// Gets a collection of SubscriptionLongTermRetentionManagedInstanceBackupResources in the SubscriptionResource. /// @@ -3747,144 +3679,146 @@ public static Response - /// Gets a list of all deleted servers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers - /// - /// - /// Operation Id - /// DeletedServers_List - /// - /// + /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetDeletedServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of SubscriptionLongTermRetentionBackupResources and their operations over a SubscriptionLongTermRetentionBackupResource. + public static SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServersAsync(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); } /// - /// Gets a list of all deleted servers in a subscription. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// DeletedServers_List + /// LongTermRetentionBackups_Get /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetDeletedServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSubscriptionLongTermRetentionBackupAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServers(cancellationToken); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a list of all instance pools in the subscription. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// InstancePools_List + /// LongTermRetentionBackups_Get /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetInstancePoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSubscriptionLongTermRetentionBackup(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePoolsAsync(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); } /// - /// Gets a list of all instance pools in the subscription. + /// Gets a list of all deleted servers in a subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers /// /// /// Operation Id - /// InstancePools_List + /// DeletedServers_List /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetInstancePools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDeletedServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePools(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServersAsync(cancellationToken); } /// - /// Gets the subscription capabilities available for the specified location. + /// Gets a list of all deleted servers in a subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers /// /// /// Operation Id - /// Capabilities_ListByLocation + /// DeletedServers_List /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location name whose capabilities are retrieved. - /// If specified, restricts the response to only include the selected item. /// The cancellation token to use. /// is null. - public static async Task> GetCapabilitiesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDeletedServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableSqlSubscriptionResource(subscriptionResource).GetCapabilitiesByLocationAsync(locationName, include, cancellationToken).ConfigureAwait(false); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServers(cancellationToken); } /// @@ -3905,201 +3839,102 @@ public static async Task> GetCapabilitiesByLoc /// /// /// The instance the method will execute against. - /// The location name whose capabilities are retrieved. - /// If specified, restricts the response to only include the selected item. - /// The cancellation token to use. - /// is null. - public static Response GetCapabilitiesByLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(subscriptionResource).GetCapabilitiesByLocation(locationName, include, cancellationToken); - } - - /// - /// Gets a collection of sync database ids. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// - /// - /// Operation Id - /// SyncGroups_ListSyncDatabaseIds - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(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 - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetSyncDatabaseIdsSyncGroups(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); - } - - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByLocation - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The location name whose capabilities are retrieved. + /// If specified, restricts the response to only include the selected item. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + public static async Task> GetCapabilitiesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetCapabilitiesByLocationAsync(locationName, include, cancellationToken).ConfigureAwait(false); } /// - /// Lists the long term retention backups for a given location. + /// Gets the subscription capabilities available for the specified location. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities /// /// /// Operation Id - /// LongTermRetentionBackups_ListByLocation + /// Capabilities_ListByLocation /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The location name whose capabilities are retrieved. + /// If specified, restricts the response to only include the selected item. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetLongTermRetentionBackupsWithLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + public static Response GetCapabilitiesByLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetCapabilitiesByLocation(locationName, include, cancellationToken); } /// - /// Lists the long term retention backups for a given server. + /// Gets a collection of sync database ids. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds /// /// /// Operation Id - /// LongTermRetentionBackups_ListByServer + /// SyncGroups_ListSyncDatabaseIds /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The 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. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetLongTermRetentionBackupsWithServerAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); } /// - /// Lists the long term retention backups for a given server. + /// Gets a collection of sync database ids. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds /// /// /// Operation Id - /// LongTermRetentionBackups_ListByServer + /// SyncGroups_ListSyncDatabaseIds /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The 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. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetLongTermRetentionBackupsWithServer(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSyncDatabaseIdsSyncGroups(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); } /// @@ -4457,5 +4292,189 @@ public static Pageable GetSqlServers(this SubscriptionResourc return GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlServers(expand, cancellationToken); } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetInstancePoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePoolsAsync(cancellationToken); + } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetInstancePools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePools(cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByLocation + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByLocation + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetLongTermRetentionBackupsWithLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByServer + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetLongTermRetentionBackupsWithServerAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByServer + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetLongTermRetentionBackupsWithServer(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs index 04fa9946d27af..55749bb4255f5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs @@ -35,12 +35,16 @@ public InstancePoolData(AzureLocation location) : base(location) /// Resource ID of the subnet to place this instance pool in. /// Count of vCores belonging to this instance pool. /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). - internal InstancePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, ResourceIdentifier subnetId, int? vCores, InstancePoolLicenseType? licenseType) : base(id, name, resourceType, systemData, tags, location) + /// The Dns Zone that the managed instance pool is in. + /// Specifies maintenance configuration id to apply to this managed instance. + internal InstancePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, ResourceIdentifier subnetId, int? vCores, InstancePoolLicenseType? licenseType, string dnsZone, ResourceIdentifier maintenanceConfigurationId) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; SubnetId = subnetId; VCores = vCores; LicenseType = licenseType; + DnsZone = dnsZone; + MaintenanceConfigurationId = maintenanceConfigurationId; } /// The name and tier of the SKU. @@ -51,5 +55,9 @@ internal InstancePoolData(ResourceIdentifier id, string name, ResourceType resou public int? VCores { get; set; } /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). public InstancePoolLicenseType? LicenseType { get; set; } + /// The Dns Zone that the managed instance pool is in. + public string DnsZone { get; } + /// Specifies maintenance configuration id to apply to this managed instance. + public ResourceIdentifier MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointCollection.cs new file mode 100644 index 0000000000000..0e89f358a29b9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointCollection.cs @@ -0,0 +1,415 @@ +// 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.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetJobPrivateEndpoints method from an instance of . + /// + public partial class JobPrivateEndpointCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _jobPrivateEndpointClientDiagnostics; + private readonly JobPrivateEndpointsRestOperations _jobPrivateEndpointRestClient; + + /// Initializes a new instance of the class for mocking. + protected JobPrivateEndpointCollection() + { + } + + /// 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 JobPrivateEndpointCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _jobPrivateEndpointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", JobPrivateEndpointResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(JobPrivateEndpointResource.ResourceType, out string jobPrivateEndpointApiVersion); + _jobPrivateEndpointRestClient = new JobPrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, jobPrivateEndpointApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SqlServerJobAgentResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SqlServerJobAgentResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the private endpoint. + /// The requested private endpoint state. + /// 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 privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the private endpoint. + /// The requested private endpoint state. + /// 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 privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data, cancellationToken); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Get"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Get"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of job agent private endpoints. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints + /// + /// + /// Operation Id + /// JobPrivateEndpoints_ListByAgent + /// + /// + /// + /// 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) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _jobPrivateEndpointRestClient.CreateListByAgentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _jobPrivateEndpointRestClient.CreateListByAgentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new JobPrivateEndpointResource(Client, JobPrivateEndpointData.DeserializeJobPrivateEndpointData(e)), _jobPrivateEndpointClientDiagnostics, Pipeline, "JobPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of job agent private endpoints. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints + /// + /// + /// Operation Id + /// JobPrivateEndpoints_ListByAgent + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _jobPrivateEndpointRestClient.CreateListByAgentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _jobPrivateEndpointRestClient.CreateListByAgentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new JobPrivateEndpointResource(Client, JobPrivateEndpointData.DeserializeJobPrivateEndpointData(e)), _jobPrivateEndpointClientDiagnostics, Pipeline, "JobPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Exists"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Exists"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), 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/JobPrivateEndpointData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointData.cs new file mode 100644 index 0000000000000..e134c4b7c193c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointData.cs @@ -0,0 +1,42 @@ +// 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 JobPrivateEndpoint data model. + /// A job agent private endpoint. + /// + public partial class JobPrivateEndpointData : ResourceData + { + /// Initializes a new instance of . + public JobPrivateEndpointData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ARM resource id of the server the private endpoint will target. + /// Private endpoint id of the private endpoint. + internal JobPrivateEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier targetServerAzureResourceId, string privateEndpointId) : base(id, name, resourceType, systemData) + { + TargetServerAzureResourceId = targetServerAzureResourceId; + PrivateEndpointId = privateEndpointId; + } + + /// ARM resource id of the server the private endpoint will target. + public ResourceIdentifier TargetServerAzureResourceId { get; set; } + /// Private endpoint id of the private endpoint. + public string PrivateEndpointId { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointResource.cs new file mode 100644 index 0000000000000..390e1933e2c78 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing a JobPrivateEndpoint 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 GetJobPrivateEndpointResource method. + /// Otherwise you can get one from its parent resource using the GetJobPrivateEndpoint method. + /// + public partial class JobPrivateEndpointResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The privateEndpointName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _jobPrivateEndpointClientDiagnostics; + private readonly JobPrivateEndpointsRestOperations _jobPrivateEndpointRestClient; + private readonly JobPrivateEndpointData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/servers/jobAgents/privateEndpoints"; + + /// Initializes a new instance of the class for mocking. + protected JobPrivateEndpointResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal JobPrivateEndpointResource(ArmClient client, JobPrivateEndpointData 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 JobPrivateEndpointResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _jobPrivateEndpointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string jobPrivateEndpointApiVersion); + _jobPrivateEndpointRestClient = new JobPrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, jobPrivateEndpointApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 JobPrivateEndpointData 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 private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Get"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Get"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_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 = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Delete"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateDeleteRequest(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); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_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 = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Delete"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(_jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_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 requested private endpoint state. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Update"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_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 requested private endpoint state. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Update"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/JobPrivateEndpointOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/JobPrivateEndpointOperationSource.cs new file mode 100644 index 0000000000000..ee88f6ef2b065 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/JobPrivateEndpointOperationSource.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 JobPrivateEndpointOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal JobPrivateEndpointOperationSource(ArmClient client) + { + _client = client; + } + + JobPrivateEndpointResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return new JobPrivateEndpointResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return new JobPrivateEndpointResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ResourceGroupLongTermRetentionBackupOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ResourceGroupLongTermRetentionBackupOperationSource.cs new file mode 100644 index 0000000000000..1a8ea56e86268 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ResourceGroupLongTermRetentionBackupOperationSource.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 ResourceGroupLongTermRetentionBackupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ResourceGroupLongTermRetentionBackupOperationSource(ArmClient client) + { + _client = client; + } + + ResourceGroupLongTermRetentionBackupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData(document.RootElement); + return new ResourceGroupLongTermRetentionBackupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData(document.RootElement); + return new ResourceGroupLongTermRetentionBackupResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/SubscriptionLongTermRetentionBackupOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/SubscriptionLongTermRetentionBackupOperationSource.cs new file mode 100644 index 0000000000000..d1ff076730a6a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/SubscriptionLongTermRetentionBackupOperationSource.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 SubscriptionLongTermRetentionBackupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SubscriptionLongTermRetentionBackupOperationSource(ArmClient client) + { + _client = client; + } + + SubscriptionLongTermRetentionBackupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData(document.RootElement); + return new SubscriptionLongTermRetentionBackupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData(document.RootElement); + return new SubscriptionLongTermRetentionBackupResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupData.cs index eab38c65b8fec..18ee3f21000bb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupData.cs @@ -36,7 +36,9 @@ public LongTermRetentionBackupData() /// The time the long term retention backup will expire. /// The storage redundancy type of the backup. /// The storage redundancy type of the backup. - internal LongTermRetentionBackupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string serverName, DateTimeOffset? serverCreateOn, string databaseName, DateTimeOffset? databaseDeletedOn, DateTimeOffset? backupOn, DateTimeOffset? backupExpireOn, SqlBackupStorageRedundancy? backupStorageRedundancy, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy) : base(id, name, resourceType, systemData) + /// The setting whether the LTR backup is immutable. + /// The BackupStorageAccessTier for the LTR backup. + internal LongTermRetentionBackupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string serverName, DateTimeOffset? serverCreateOn, string databaseName, DateTimeOffset? databaseDeletedOn, DateTimeOffset? backupOn, DateTimeOffset? backupExpireOn, SqlBackupStorageRedundancy? backupStorageRedundancy, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy, bool? isBackupImmutable, BackupStorageAccessTier? backupStorageAccessTier) : base(id, name, resourceType, systemData) { ServerName = serverName; ServerCreateOn = serverCreateOn; @@ -46,6 +48,8 @@ internal LongTermRetentionBackupData(ResourceIdentifier id, string name, Resourc BackupExpireOn = backupExpireOn; BackupStorageRedundancy = backupStorageRedundancy; RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + IsBackupImmutable = isBackupImmutable; + BackupStorageAccessTier = backupStorageAccessTier; } /// The server name that the backup database belong to. @@ -64,5 +68,9 @@ internal LongTermRetentionBackupData(ResourceIdentifier id, string name, Resourc public SqlBackupStorageRedundancy? BackupStorageRedundancy { get; } /// The storage redundancy type of the backup. public SqlBackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + /// The setting whether the LTR backup is immutable. + public bool? IsBackupImmutable { get; set; } + /// The BackupStorageAccessTier for the LTR backup. + public BackupStorageAccessTier? BackupStorageAccessTier { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs index 8deca8b7a9679..bb3356f27599f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs @@ -55,7 +55,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Sets a database's long term retention policy. + /// Set or update a database's long term retention policy. /// /// /// Request Path @@ -94,7 +94,7 @@ public virtual async Task> CreateO } /// - /// Sets a database's long term retention policy. + /// Set or update a database's long term retention policy. /// /// /// Request Path diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyData.cs index 1449372012b7d..64bd91715042f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyData.cs @@ -7,6 +7,7 @@ using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql { @@ -26,18 +27,26 @@ public LongTermRetentionPolicyData() /// The name. /// The resourceType. /// The systemData. + /// The setting whether to make LTR backups immutable. + /// The BackupStorageAccessTier for the LTR backups. /// The weekly retention policy for an LTR backup in an ISO 8601 format. /// The monthly retention policy for an LTR backup in an ISO 8601 format. /// The yearly retention policy for an LTR backup in an ISO 8601 format. /// The week of year to take the yearly backup in an ISO 8601 format. - internal LongTermRetentionPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string weeklyRetention, string monthlyRetention, string yearlyRetention, int? weekOfYear) : base(id, name, resourceType, systemData) + internal LongTermRetentionPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? makeBackupsImmutable, BackupStorageAccessTier? backupStorageAccessTier, string weeklyRetention, string monthlyRetention, string yearlyRetention, int? weekOfYear) : base(id, name, resourceType, systemData) { + MakeBackupsImmutable = makeBackupsImmutable; + BackupStorageAccessTier = backupStorageAccessTier; WeeklyRetention = weeklyRetention; MonthlyRetention = monthlyRetention; YearlyRetention = yearlyRetention; WeekOfYear = weekOfYear; } + /// The setting whether to make LTR backups immutable. + public bool? MakeBackupsImmutable { get; set; } + /// The BackupStorageAccessTier for the LTR backups. + public BackupStorageAccessTier? BackupStorageAccessTier { get; set; } /// The weekly retention policy for an LTR backup in an ISO 8601 format. public string WeeklyRetention { get; set; } /// The monthly retention policy for an LTR backup in an ISO 8601 format. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs index 2542358678950..0bbfdb616a52a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs @@ -157,7 +157,7 @@ public virtual Response Get(CancellationToken c } /// - /// Sets a database's long term retention policy. + /// Set or update a database's long term retention policy. /// /// /// Request Path @@ -195,7 +195,7 @@ public virtual async Task> UpdateA } /// - /// Sets a database's long term retention policy. + /// Set or update a database's long term retention policy. /// /// /// Request Path diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageAccessTier.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageAccessTier.cs new file mode 100644 index 0000000000000..71f2faa84b1d3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageAccessTier.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 BackupStorageAccessTier for the LTR backup. + public readonly partial struct BackupStorageAccessTier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BackupStorageAccessTier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HotValue = "Hot"; + private const string ArchiveValue = "Archive"; + + /// Hot. + public static BackupStorageAccessTier Hot { get; } = new BackupStorageAccessTier(HotValue); + /// Archive. + public static BackupStorageAccessTier Archive { get; } = new BackupStorageAccessTier(ArchiveValue); + /// Determines if two values are the same. + public static bool operator ==(BackupStorageAccessTier left, BackupStorageAccessTier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BackupStorageAccessTier left, BackupStorageAccessTier right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BackupStorageAccessTier(string value) => new BackupStorageAccessTier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BackupStorageAccessTier other && Equals(other); + /// + public bool Equals(BackupStorageAccessTier 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/ChangeLongTermRetentionBackupAccessTierParameters.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ChangeLongTermRetentionBackupAccessTierParameters.Serialization.cs new file mode 100644 index 0000000000000..ccf4141e1bd34 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ChangeLongTermRetentionBackupAccessTierParameters.Serialization.cs @@ -0,0 +1,25 @@ +// 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 ChangeLongTermRetentionBackupAccessTierParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("backupStorageAccessTier"u8); + writer.WriteStringValue(BackupStorageAccessTier); + writer.WritePropertyName("operationMode"u8); + writer.WriteStringValue(OperationMode); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ChangeLongTermRetentionBackupAccessTierParameters.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ChangeLongTermRetentionBackupAccessTierParameters.cs new file mode 100644 index 0000000000000..9e23ed811be36 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ChangeLongTermRetentionBackupAccessTierParameters.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains the information necessary to change long term retention backup access tier and related operation mode. + public partial class ChangeLongTermRetentionBackupAccessTierParameters + { + /// Initializes a new instance of . + /// The long term retention backup storage access tier. + /// The operation mode when updating ltr backup storage access tier. + /// or is null. + public ChangeLongTermRetentionBackupAccessTierParameters(string backupStorageAccessTier, string operationMode) + { + Argument.AssertNotNull(backupStorageAccessTier, nameof(backupStorageAccessTier)); + Argument.AssertNotNull(operationMode, nameof(operationMode)); + + BackupStorageAccessTier = backupStorageAccessTier; + OperationMode = operationMode; + } + + /// The long term retention backup storage access tier. + public string BackupStorageAccessTier { get; } + /// The operation mode when updating ltr backup storage access tier. + public string OperationMode { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs index 1b38d7d408306..9a4d980c0d075 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs @@ -53,6 +53,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("licenseType"u8); writer.WriteStringValue(LicenseType.Value.ToString()); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"u8); + writer.WriteStringValue(MaintenanceConfigurationId); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -73,6 +78,8 @@ internal static InstancePoolData DeserializeInstancePoolData(JsonElement element Optional subnetId = default; Optional vCores = default; Optional licenseType = default; + Optional dnsZone = default; + Optional maintenanceConfigurationId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -163,11 +170,25 @@ internal static InstancePoolData DeserializeInstancePoolData(JsonElement element licenseType = new InstancePoolLicenseType(property0.Value.GetString()); continue; } + if (property0.NameEquals("dnsZone"u8)) + { + dnsZone = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("maintenanceConfigurationId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maintenanceConfigurationId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } } continue; } } - return new InstancePoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, subnetId.Value, Optional.ToNullable(vCores), Optional.ToNullable(licenseType)); + return new InstancePoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, subnetId.Value, Optional.ToNullable(vCores), Optional.ToNullable(licenseType), dnsZone.Value, maintenanceConfigurationId.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs index 9c8236e7e8936..efec08e572fe4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs @@ -15,6 +15,11 @@ public partial class InstancePoolPatch : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -26,6 +31,29 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + if (Optional.IsDefined(VCores)) + { + writer.WritePropertyName("vCores"u8); + writer.WriteNumberValue(VCores.Value); + } + if (Optional.IsDefined(LicenseType)) + { + writer.WritePropertyName("licenseType"u8); + writer.WriteStringValue(LicenseType.Value.ToString()); + } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"u8); + writer.WriteStringValue(MaintenanceConfigurationId); + } + writer.WriteEndObject(); writer.WriteEndObject(); } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs index bf06c3a4f0b8c..a6d4bda3f7a12 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs @@ -20,13 +20,37 @@ public InstancePoolPatch() } /// Initializes a new instance of . + /// The name and tier of the SKU. /// Resource tags. - internal InstancePoolPatch(IDictionary tags) + /// Resource ID of the subnet to place this instance pool in. + /// Count of vCores belonging to this instance pool. + /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). + /// The Dns Zone that the managed instance pool is in. + /// Specifies maintenance configuration id to apply to this managed instance. + internal InstancePoolPatch(SqlSku sku, IDictionary tags, ResourceIdentifier subnetId, int? vCores, InstancePoolLicenseType? licenseType, string dnsZone, ResourceIdentifier maintenanceConfigurationId) { + Sku = sku; Tags = tags; + SubnetId = subnetId; + VCores = vCores; + LicenseType = licenseType; + DnsZone = dnsZone; + MaintenanceConfigurationId = maintenanceConfigurationId; } + /// The name and tier of the SKU. + public SqlSku Sku { get; set; } /// Resource tags. public IDictionary Tags { get; } + /// Resource ID of the subnet to place this instance pool in. + public ResourceIdentifier SubnetId { get; set; } + /// Count of vCores belonging to this instance pool. + public int? VCores { get; set; } + /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). + public InstancePoolLicenseType? LicenseType { get; set; } + /// The Dns Zone that the managed instance pool is in. + public string DnsZone { get; } + /// Specifies maintenance configuration id to apply to this managed instance. + public ResourceIdentifier MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointData.Serialization.cs new file mode 100644 index 0000000000000..853bed6308ff6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointData.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + public partial class JobPrivateEndpointData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TargetServerAzureResourceId)) + { + writer.WritePropertyName("targetServerAzureResourceId"u8); + writer.WriteStringValue(TargetServerAzureResourceId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static JobPrivateEndpointData DeserializeJobPrivateEndpointData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional targetServerAzureResourceId = default; + Optional privateEndpointId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("targetServerAzureResourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetServerAzureResourceId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("privateEndpointId"u8)) + { + privateEndpointId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new JobPrivateEndpointData(id, name, type, systemData.Value, targetServerAzureResourceId.Value, privateEndpointId.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.Serialization.cs new file mode 100644 index 0000000000000..48a9218272be0 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class JobPrivateEndpointListResult + { + internal static JobPrivateEndpointListResult DeserializeJobPrivateEndpointListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JobPrivateEndpointData.DeserializeJobPrivateEndpointData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new JobPrivateEndpointListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.cs new file mode 100644 index 0000000000000..da3e22e6649d2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.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 job agent private endpoints. + internal partial class JobPrivateEndpointListResult + { + /// Initializes a new instance of . + internal JobPrivateEndpointListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Array of results. + /// Link to retrieve next page of results. + internal JobPrivateEndpointListResult(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/LongTermRetentionBackupData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupData.Serialization.cs index 908efa44330bc..80dba93e27e78 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupData.Serialization.cs @@ -25,6 +25,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("requestedBackupStorageRedundancy"u8); writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); } + if (Optional.IsDefined(IsBackupImmutable)) + { + writer.WritePropertyName("isBackupImmutable"u8); + writer.WriteBooleanValue(IsBackupImmutable.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -47,6 +52,8 @@ internal static LongTermRetentionBackupData DeserializeLongTermRetentionBackupDa Optional backupExpirationTime = default; Optional backupStorageRedundancy = default; Optional requestedBackupStorageRedundancy = default; + Optional isBackupImmutable = default; + Optional backupStorageAccessTier = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -146,11 +153,29 @@ internal static LongTermRetentionBackupData DeserializeLongTermRetentionBackupDa requestedBackupStorageRedundancy = new SqlBackupStorageRedundancy(property0.Value.GetString()); continue; } + if (property0.NameEquals("isBackupImmutable"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isBackupImmutable = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("backupStorageAccessTier"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupStorageAccessTier = new BackupStorageAccessTier(property0.Value.GetString()); + continue; + } } continue; } } - return new LongTermRetentionBackupData(id, name, type, systemData.Value, serverName.Value, Optional.ToNullable(serverCreateTime), databaseName.Value, Optional.ToNullable(databaseDeletionTime), Optional.ToNullable(backupTime), Optional.ToNullable(backupExpirationTime), Optional.ToNullable(backupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy)); + return new LongTermRetentionBackupData(id, name, type, systemData.Value, serverName.Value, Optional.ToNullable(serverCreateTime), databaseName.Value, Optional.ToNullable(databaseDeletionTime), Optional.ToNullable(backupTime), Optional.ToNullable(backupExpirationTime), Optional.ToNullable(backupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(isBackupImmutable), Optional.ToNullable(backupStorageAccessTier)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyData.Serialization.cs index f8c433c6a21e9..ab6de8e2c814e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyData.Serialization.cs @@ -8,6 +8,7 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql { @@ -18,6 +19,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (Optional.IsDefined(MakeBackupsImmutable)) + { + writer.WritePropertyName("makeBackupsImmutable"u8); + writer.WriteBooleanValue(MakeBackupsImmutable.Value); + } + if (Optional.IsDefined(BackupStorageAccessTier)) + { + writer.WritePropertyName("backupStorageAccessTier"u8); + writer.WriteStringValue(BackupStorageAccessTier.Value.ToString()); + } if (Optional.IsDefined(WeeklyRetention)) { writer.WritePropertyName("weeklyRetention"u8); @@ -52,6 +63,8 @@ internal static LongTermRetentionPolicyData DeserializeLongTermRetentionPolicyDa string name = default; ResourceType type = default; Optional systemData = default; + Optional makeBackupsImmutable = default; + Optional backupStorageAccessTier = default; Optional weeklyRetention = default; Optional monthlyRetention = default; Optional yearlyRetention = default; @@ -91,6 +104,24 @@ internal static LongTermRetentionPolicyData DeserializeLongTermRetentionPolicyDa } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("makeBackupsImmutable"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + makeBackupsImmutable = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("backupStorageAccessTier"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupStorageAccessTier = new BackupStorageAccessTier(property0.Value.GetString()); + continue; + } if (property0.NameEquals("weeklyRetention"u8)) { weeklyRetention = property0.Value.GetString(); @@ -119,7 +150,7 @@ internal static LongTermRetentionPolicyData DeserializeLongTermRetentionPolicyDa continue; } } - return new LongTermRetentionPolicyData(id, name, type, systemData.Value, weeklyRetention.Value, monthlyRetention.Value, yearlyRetention.Value, Optional.ToNullable(weekOfYear)); + return new LongTermRetentionPolicyData(id, name, type, systemData.Value, Optional.ToNullable(makeBackupsImmutable), Optional.ToNullable(backupStorageAccessTier), weeklyRetention.Value, monthlyRetention.Value, yearlyRetention.Value, Optional.ToNullable(weekOfYear)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlBackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlBackupStorageRedundancy.cs index 4200def18f5d1..dca365c0f18ae 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlBackupStorageRedundancy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlBackupStorageRedundancy.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// The storage redundancy type of the copied backup. + /// The storage redundancy type of the backup. public readonly partial struct SqlBackupStorageRedundancy : IEquatable { private readonly string _value; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs index acb0af32f4259..1ec81e98751db 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs @@ -141,7 +141,7 @@ public virtual Response Get(string } /// - /// Lists all long term retention backups for a database. + /// Lists all long term retention backups for a database based on a particular resource group. /// /// /// Request Path @@ -165,7 +165,7 @@ public virtual AsyncPageable GetAl } /// - /// Lists all long term retention backups for a database. + /// Lists all long term retention backups for a database based on a particular resource group. /// /// /// Request Path diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs index 79fd2b4c4e6e9..92c31adf77722 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs @@ -226,6 +226,82 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } } + /// + /// Change a long term retention backup access tier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/changeAccessTier + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ChangeAccessTierByResourceGroup + /// + /// + /// + /// 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 to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> ChangeAccessTierByResourceGroupAsync(WaitUntil waitUntil, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); + + using var scope = _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupLongTermRetentionBackupResource.ChangeAccessTierByResourceGroup"); + scope.Start(); + try + { + var response = await _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsRestClient.ChangeAccessTierByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ResourceGroupLongTermRetentionBackupOperationSource(Client), _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics, Pipeline, _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsRestClient.CreateChangeAccessTierByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Change a long term retention backup access tier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/changeAccessTier + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ChangeAccessTierByResourceGroup + /// + /// + /// + /// 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 to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ChangeAccessTierByResourceGroup(WaitUntil waitUntil, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); + + using var scope = _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupLongTermRetentionBackupResource.ChangeAccessTierByResourceGroup"); + scope.Start(); + try + { + var response = _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsRestClient.ChangeAccessTierByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters, cancellationToken); + var operation = new SqlArmOperation(new ResourceGroupLongTermRetentionBackupOperationSource(Client), _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics, Pipeline, _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsRestClient.CreateChangeAccessTierByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Copy an existing long term retention backup to a different server. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs index f461a606e1c31..966c5f4a3938b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs @@ -33,10 +33,150 @@ public InstancePoolsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal HttpMessage CreateListRequest(string subscriptionId) + { + 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/instancePools", 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 all instance pools in the subscription. + /// The subscription ID that identifies an Azure subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InstancePoolListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of all instance pools in the subscription. + /// The subscription ID that identifies an Azure subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InstancePoolListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + 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/instancePools", 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 instance pools in the resource group. + /// 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 cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InstancePoolListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of instance pools in the resource group. + /// 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 cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InstancePoolListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instancePoolName) { var message = _pipeline.CreateMessage(); @@ -348,90 +488,14 @@ public Response Update(string subscriptionId, string resourceGroupName, string i } } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - 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/instancePools", 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 instance pools in the resource group. - /// 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 cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InstancePoolListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of instance pools in the resource group. - /// 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 cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InstancePoolListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListRequest(string subscriptionId) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) { 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/instancePools", false); - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -439,15 +503,17 @@ internal HttpMessage CreateListRequest(string subscriptionId) } /// Gets a list of all instance pools in the subscription. + /// The URL to the next page of results. /// The subscription ID that identifies an Azure subscription. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListRequest(subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -464,15 +530,17 @@ public async Task> ListAsync(string subscriptio } /// Gets a list of all instance pools in the subscription. + /// The URL to the next page of results. /// The subscription ID that identifies an Azure subscription. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, CancellationToken cancellationToken = default) + public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListRequest(subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -559,73 +627,5 @@ public Response ListByResourceGroupNextPage(string nextL throw new RequestFailedException(message.Response); } } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) - { - 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 all instance pools in the subscription. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InstancePoolListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of all instance pools in the subscription. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InstancePoolListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InstancePoolListResult.DeserializeInstancePoolListResult(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/JobPrivateEndpointsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/JobPrivateEndpointsRestOperations.cs new file mode 100644 index 0000000000000..86195928a6f9c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/JobPrivateEndpointsRestOperations.cs @@ -0,0 +1,474 @@ +// 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 JobPrivateEndpointsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of JobPrivateEndpointsRestOperations. + /// 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 JobPrivateEndpointsRestOperations(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 ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByAgentRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName) + { + 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("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints", 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 job agent private endpoints. + /// 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 job agent. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAgentAsync(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentRequest(subscriptionId, resourceGroupName, serverName, jobAgentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of job agent private endpoints. + /// 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 job agent. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAgent(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentRequest(subscriptionId, resourceGroupName, serverName, jobAgentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) + { + 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("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints/", false); + uri.AppendPath(privateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a private endpoint. + /// 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 job agent. + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((JobPrivateEndpointData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a private endpoint. + /// 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 job agent. + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((JobPrivateEndpointData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, JobPrivateEndpointData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints/", false); + uri.AppendPath(privateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a private endpoint. + /// 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 job agent. + /// The name of the private endpoint. + /// The requested private endpoint state. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a private endpoint. + /// 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 job agent. + /// The name of the private endpoint. + /// The requested private endpoint state. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints/", false); + uri.AppendPath(privateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Deletes a private endpoint. + /// 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 job agent. + /// The name of the private endpoint to delete. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + 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 private endpoint. + /// 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 job agent. + /// The name of the private endpoint to delete. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + _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 CreateListByAgentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string jobAgentName) + { + 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 job agent private endpoints. + /// 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 job agent. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAgentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, 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(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, jobAgentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of job agent private endpoints. + /// 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 job agent. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAgentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, 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(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, jobAgentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs index 6e38a7f4a971a..ce1857e91cbb6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionBackupsRestOperations.cs @@ -33,15 +33,98 @@ public LongTermRetentionBackupsRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01-preview"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateCopyRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content) + internal HttpMessage CreateListByLocationRequest(string subscriptionId, AzureLocation locationName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) { 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); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionBackups", false); + if (onlyLatestPerDatabase != null) + { + uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); + } + if (databaseState != null) + { + uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the long term retention backups for a given location. + /// The subscription ID that identifies an Azure subscription. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListByLocationAsync(string subscriptionId, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListByLocationRequest(subscriptionId, locationName, onlyLatestPerDatabase, databaseState); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionBackupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the long term retention backups for a given location. + /// The subscription ID that identifies an Azure subscription. + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListByLocation(string subscriptionId, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListByLocationRequest(subscriptionId, locationName, onlyLatestPerDatabase, databaseState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionBackupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -50,87 +133,87 @@ internal HttpMessage CreateCopyRequest(string subscriptionId, AzureLocation loca uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); uri.AppendPath(longTermRetentionServerName, true); - uri.AppendPath("/longTermRetentionDatabases/", false); - uri.AppendPath(longTermRetentionDatabaseName, true); - uri.AppendPath("/longTermRetentionBackups/", false); - uri.AppendPath(backupName, true); - uri.AppendPath("/copy", false); + uri.AppendPath("/longTermRetentionBackups", false); + if (onlyLatestPerDatabase != null) + { + uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); + } + if (databaseState != null) + { + uri.AppendQuery("databaseState", databaseState.Value.ToString(), 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; } - /// Copy an existing long term retention backup. + /// Lists the long term retention backups for a given server. /// The subscription ID that identifies an Azure subscription. /// The location of the database. /// The name of the server. - /// The name of the database. - /// The backup name. - /// The parameters needed for long term retention copy request. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CopyAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByServerAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCopyRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByServerRequest(subscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Copy an existing long term retention backup. + /// Lists the long term retention backups for a given server. /// The subscription ID that identifies an Azure subscription. /// The location of the database. /// The name of the server. - /// The name of the database. - /// The backup name. - /// The parameters needed for long term retention copy request. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Copy(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByServer(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCopyRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByServerRequest(subscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) { 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); @@ -141,75 +224,81 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, AzureLocation lo uri.AppendPath(longTermRetentionServerName, true); uri.AppendPath("/longTermRetentionDatabases/", false); uri.AppendPath(longTermRetentionDatabaseName, true); - uri.AppendPath("/longTermRetentionBackups/", false); - uri.AppendPath(backupName, true); - uri.AppendPath("/update", false); + uri.AppendPath("/longTermRetentionBackups", false); + if (onlyLatestPerDatabase != null) + { + uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); + } + if (databaseState != null) + { + uri.AppendQuery("databaseState", databaseState.Value.ToString(), 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; } - /// Updates an existing long term retention backup. + /// Lists all long term retention backups for a database. /// The subscription ID that identifies an Azure subscription. /// The location of the database. /// The name of the server. /// The name of the database. - /// The backup name. - /// The requested backup resource state. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByDatabaseAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateUpdateRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByDatabaseRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Updates an existing long term retention backup. + /// Lists all long term retention backups for a database. /// The subscription ID that identifies an Azure subscription. /// The location of the database. /// The name of the server. /// The name of the database. - /// The backup name. - /// The requested backup resource state. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByDatabase(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateUpdateRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByDatabaseRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -326,6 +415,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, AzureLocation lo uri.AppendPath(backupName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } @@ -386,11 +476,11 @@ public Response Delete(string subscriptionId, AzureLocation locationName, string } } - internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + internal HttpMessage CreateChangeAccessTierRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters) { 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); @@ -401,170 +491,259 @@ internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, AzureLoc uri.AppendPath(longTermRetentionServerName, true); uri.AppendPath("/longTermRetentionDatabases/", false); uri.AppendPath(longTermRetentionDatabaseName, true); - uri.AppendPath("/longTermRetentionBackups", false); - if (onlyLatestPerDatabase != null) + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/changeAccessTier", 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(changeLongTermRetentionBackupAccessTierParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Change a long term retention backup access tier. + /// The subscription ID that identifies an Azure subscription. + /// The to use. + /// The to use. + /// The to use. + /// The to use. + /// The 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 ChangeAccessTierAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); + + using var message = CreateChangeAccessTierRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, changeLongTermRetentionBackupAccessTierParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) { - uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); } - if (databaseState != null) + } + + /// Change a long term retention backup access tier. + /// The subscription ID that identifies an Azure subscription. + /// The to use. + /// The to use. + /// The to use. + /// The to use. + /// The to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ChangeAccessTier(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); + + using var message = CreateChangeAccessTierRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, changeLongTermRetentionBackupAccessTierParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) { - uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); } + } + + internal HttpMessage CreateCopyRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content) + { + 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("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/copy", 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(content); + request.Content = content0; _userAgent.Apply(message); return message; } - /// Lists all long term retention backups for a database. + /// Copy an existing long term retention backup. /// The subscription ID that identifies an Azure subscription. /// The location of the database. /// The name of the server. /// The name 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 backup name. + /// The parameters needed for long term retention copy request. /// 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, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CopyAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByDatabaseRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateCopyRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists all long term retention backups for a database. + /// Copy an existing long term retention backup. /// The subscription ID that identifies an Azure subscription. /// The location of the database. /// The name of the server. /// The name 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 backup name. + /// The parameters needed for long term retention copy request. /// 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, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Copy(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByDatabaseRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateCopyRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateListByLocationRequest(string subscriptionId, AzureLocation locationName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + internal HttpMessage CreateUpdateRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content) { 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); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); - uri.AppendPath("/longTermRetentionBackups", false); - if (onlyLatestPerDatabase != null) - { - uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); - } - if (databaseState != null) - { - uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); - } + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/update", 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(content); + request.Content = content0; _userAgent.Apply(message); return message; } - /// Lists the long term retention backups for a given location. + /// Updates an existing long term retention backup. /// The subscription ID that identifies an Azure subscription. /// 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 server. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListByLocationAsync(string subscriptionId, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByLocationRequest(subscriptionId, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateUpdateRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists the long term retention backups for a given location. + /// Updates an existing long term retention backup. /// The subscription ID that identifies an Azure subscription. /// 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 server. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListByLocation(string subscriptionId, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByLocationRequest(subscriptionId, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateUpdateRequest(subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateListByServerRequest(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + internal HttpMessage CreateListByResourceGroupLocationRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -573,10 +752,10 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, AzureLocat uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); - uri.AppendPath("/longTermRetentionServers/", false); - uri.AppendPath(longTermRetentionServerName, true); uri.AppendPath("/longTermRetentionBackups", false); if (onlyLatestPerDatabase != null) { @@ -593,21 +772,21 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, AzureLocat return message; } - /// Lists the long term retention backups for a given server. + /// Lists the long term retention backups for a given location based on resource group. /// 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 location of the database. - /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByServerAsync(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupLocationAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByServerRequest(subscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupLocationRequest(subscriptionId, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -623,21 +802,21 @@ public async Task> ListByServerAsync } } - /// Lists the long term retention backups for a given server. + /// Lists the long term retention backups for a given location based on resource group. /// 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 location of the database. - /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByServer(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupLocation(string subscriptionId, string resourceGroupName, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByServerRequest(subscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupLocationRequest(subscriptionId, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -653,11 +832,11 @@ public Response ListByServer(string subscript } } - internal HttpMessage CreateCopyByResourceGroupRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content) + internal HttpMessage CreateListByResourceGroupServerRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) { 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); @@ -668,91 +847,91 @@ internal HttpMessage CreateCopyByResourceGroupRequest(string subscriptionId, str uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); uri.AppendPath(longTermRetentionServerName, true); - uri.AppendPath("/longTermRetentionDatabases/", false); - uri.AppendPath(longTermRetentionDatabaseName, true); - uri.AppendPath("/longTermRetentionBackups/", false); - uri.AppendPath(backupName, true); - uri.AppendPath("/copy", false); + uri.AppendPath("/longTermRetentionBackups", false); + if (onlyLatestPerDatabase != null) + { + uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); + } + if (databaseState != null) + { + uri.AppendQuery("databaseState", databaseState.Value.ToString(), 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; } - /// Copy an existing long term retention backup to a different server. + /// Lists the long term retention backups for a given server based on resource groups. /// 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 location of the database. /// The name of the server. - /// The name of the database. - /// The backup name. - /// The parameters needed for long term retention copy request. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task CopyByResourceGroupAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupServerAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCopyByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByResourceGroupServerRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Copy an existing long term retention backup to a different server. + /// Lists the long term retention backups for a given server based on resource groups. /// 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 location of the database. /// The name of the server. - /// The name of the database. - /// The backup name. - /// The parameters needed for long term retention copy request. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response CopyByResourceGroup(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupServer(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCopyByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByResourceGroupServerRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateUpdateByResourceGroupRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content) + internal HttpMessage CreateListByResourceGroupDatabaseRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) { 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); @@ -765,79 +944,85 @@ internal HttpMessage CreateUpdateByResourceGroupRequest(string subscriptionId, s uri.AppendPath(longTermRetentionServerName, true); uri.AppendPath("/longTermRetentionDatabases/", false); uri.AppendPath(longTermRetentionDatabaseName, true); - uri.AppendPath("/longTermRetentionBackups/", false); - uri.AppendPath(backupName, true); - uri.AppendPath("/update", false); + uri.AppendPath("/longTermRetentionBackups", false); + if (onlyLatestPerDatabase != null) + { + uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); + } + if (databaseState != null) + { + uri.AppendQuery("databaseState", databaseState.Value.ToString(), 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; } - /// Updates an existing long term retention backup. + /// Lists all long term retention backups for a database based on a particular resource group. /// 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 location of the database. /// The name of the server. /// The name of the database. - /// The backup name. - /// The requested backup resource state. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task UpdateByResourceGroupAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupDatabaseAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateUpdateByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByResourceGroupDatabaseRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Updates an existing long term retention backup. + /// Lists all long term retention backups for a database based on a particular resource group. /// 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 location of the database. /// The name of the server. /// The name of the database. - /// The backup name. - /// The requested backup resource state. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response UpdateByResourceGroup(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupDatabase(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateUpdateByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); + using var message = CreateListByResourceGroupDatabaseRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionBackupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -962,6 +1147,7 @@ internal HttpMessage CreateDeleteByResourceGroupRequest(string subscriptionId, s uri.AppendPath(backupName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } @@ -1026,11 +1212,11 @@ public Response DeleteByResourceGroup(string subscriptionId, string resourceGrou } } - internal HttpMessage CreateListByResourceGroupDatabaseRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + internal HttpMessage CreateChangeAccessTierByResourceGroupRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters) { 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); @@ -1043,351 +1229,269 @@ internal HttpMessage CreateListByResourceGroupDatabaseRequest(string subscriptio uri.AppendPath(longTermRetentionServerName, true); uri.AppendPath("/longTermRetentionDatabases/", false); uri.AppendPath(longTermRetentionDatabaseName, true); - uri.AppendPath("/longTermRetentionBackups", false); - if (onlyLatestPerDatabase != null) - { - uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); - } - if (databaseState != null) - { - uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); - } + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/changeAccessTier", 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(changeLongTermRetentionBackupAccessTierParameters); + request.Content = content; _userAgent.Apply(message); return message; } - /// Lists all long term retention backups for a database. + /// Change a long term retention backup access tier. /// 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 location of the database. - /// The name of the server. - /// The name 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 to use. + /// The to use. + /// The to use. + /// The to use. + /// The 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> ListByResourceGroupDatabaseAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task ChangeAccessTierByResourceGroupAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); - using var message = CreateListByResourceGroupDatabaseRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateChangeAccessTierByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, changeLongTermRetentionBackupAccessTierParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists all long term retention backups for a database. + /// Change a long term retention backup access tier. /// 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 location of the database. - /// The name of the server. - /// The name 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 to use. + /// The to use. + /// The to use. + /// The to use. + /// The to use. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupDatabase(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ChangeAccessTierByResourceGroup(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); - using var message = CreateListByResourceGroupDatabaseRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListByResourceGroupLocationRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) - { - 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/locations/", false); - uri.AppendPath(locationName, true); - uri.AppendPath("/longTermRetentionBackups", false); - if (onlyLatestPerDatabase != null) - { - uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); - } - if (databaseState != null) - { - uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists the long term retention backups for a given location. - /// 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 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. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupLocationAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupLocationRequest(subscriptionId, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists the long term retention backups for a given location. - /// 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 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. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupLocation(string subscriptionId, string resourceGroupName, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupLocationRequest(subscriptionId, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateChangeAccessTierByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, changeLongTermRetentionBackupAccessTierParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateListByResourceGroupServerRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + internal HttpMessage CreateCopyByResourceGroupRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content) { 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); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/locations/", false); - uri.AppendPath(locationName, true); - uri.AppendPath("/longTermRetentionServers/", false); - uri.AppendPath(longTermRetentionServerName, true); - uri.AppendPath("/longTermRetentionBackups", false); - if (onlyLatestPerDatabase != null) - { - uri.AppendQuery("onlyLatestPerDatabase", onlyLatestPerDatabase.Value, true); - } - if (databaseState != null) - { - uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); - } + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/copy", 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(content); + request.Content = content0; _userAgent.Apply(message); return message; } - /// Lists the long term retention backups for a given server. + /// Copy an existing long term retention backup to a different 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 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 name of the database. + /// The backup name. + /// The parameters needed for long term retention copy request. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupServerAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CopyByResourceGroupAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByResourceGroupServerRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateCopyByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists the long term retention backups for a given server. + /// Copy an existing long term retention backup to a different 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 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 name of the database. + /// The backup name. + /// The parameters needed for long term retention copy request. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupServer(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CopyByResourceGroup(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByResourceGroupServerRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateCopyByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + internal HttpMessage CreateUpdateByResourceGroupRequest(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/update", 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(content); + request.Content = content0; _userAgent.Apply(message); return message; } - /// Lists all long term retention backups for a database. - /// The URL to the next page of results. + /// Updates an existing long term retention backup. /// 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 location of the database. /// The name of the server. /// The name 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 backup name. + /// The requested backup resource state. /// 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, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateByResourceGroupAsync(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateUpdateByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists all long term retention backups for a database. - /// The URL to the next page of results. + /// Updates an existing long term retention backup. /// 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 location of the database. /// The name of the server. /// The name 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 backup name. + /// The requested backup resource state. /// 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, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateByResourceGroup(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateUpdateByResourceGroupRequest(subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -1545,7 +1649,7 @@ public Response ListByServerNextPage(string n } } - internal HttpMessage CreateListByResourceGroupDatabaseNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1562,24 +1666,22 @@ internal HttpMessage CreateListByResourceGroupDatabaseNextPageRequest(string nex /// Lists all long term retention backups for a 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 location of the database. /// The name of the server. /// The name 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. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupDatabaseNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1598,24 +1700,22 @@ public async Task> ListByResourceGro /// Lists all long term retention backups for a 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 location of the database. /// The name of the server. /// The name 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. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupDatabaseNextPage(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByDatabaseNextPage(string nextLink, string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1645,7 +1745,7 @@ internal HttpMessage CreateListByResourceGroupLocationNextPageRequest(string nex return message; } - /// Lists the long term retention backups for a given location. + /// Lists the long term retention backups for a given location based on resource group. /// 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. @@ -1677,7 +1777,7 @@ public async Task> ListByResourceGro } } - /// Lists the long term retention backups for a given location. + /// Lists the long term retention backups for a given location based on resource group. /// 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. @@ -1723,7 +1823,7 @@ internal HttpMessage CreateListByResourceGroupServerNextPageRequest(string nextL return message; } - /// Lists the long term retention backups for a given server. + /// Lists the long term retention backups for a given server based on resource groups. /// 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. @@ -1757,7 +1857,7 @@ public async Task> ListByResourceGro } } - /// Lists the long term retention backups for a given server. + /// Lists the long term retention backups for a given server based on resource groups. /// 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. @@ -1790,5 +1890,91 @@ public Response ListByResourceGroupServerNext throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateListByResourceGroupDatabaseNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, SqlDatabaseState? databaseState) + { + 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; + } + + /// Lists all long term retention backups for a database based on a particular resource group. + /// 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 location of the database. + /// The name of the server. + /// The name 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. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupDatabaseNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + + using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionBackupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all long term retention backups for a database based on a particular resource group. + /// 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 location of the database. + /// The name of the server. + /// The name 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. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupDatabaseNextPage(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); + + using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionBackupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(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/LongTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionPoliciesRestOperations.cs index f64310af18b42..f4e2fbd866976 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/LongTermRetentionPoliciesRestOperations.cs @@ -33,11 +33,11 @@ public LongTermRetentionPoliciesRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -52,8 +52,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/backupLongTermRetentionPolicies/", false); - uri.AppendPath(policyName.ToString(), true); + uri.AppendPath("/backupLongTermRetentionPolicies", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -66,30 +65,27 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// 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 policy name. Should always be Default. /// 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, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + 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 = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - LongTermRetentionPolicyData value = default; + LongTermRetentionPolicyListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionPolicyData.DeserializeLongTermRetentionPolicyData(document.RootElement); + value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((LongTermRetentionPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -100,40 +96,37 @@ public async Task> GetAsync(string subscri /// 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 policy name. Should always be Default. /// 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, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + 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 = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - LongTermRetentionPolicyData value = default; + LongTermRetentionPolicyListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionPolicyData.DeserializeLongTermRetentionPolicyData(document.RootElement); + value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((LongTermRetentionPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicyData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -149,79 +142,83 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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; } - /// Sets a database's long term retention policy. + /// Gets a database's long term retention policy. /// 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 policy name. Should always be Default. - /// The long term retention policy info. /// 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, LongTermRetentionPolicyName policyName, LongTermRetentionPolicyData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionPolicyData.DeserializeLongTermRetentionPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LongTermRetentionPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Sets a database's long term retention policy. + /// Gets a database's long term retention policy. /// 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 policy name. Should always be Default. - /// The long term retention policy info. /// 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, LongTermRetentionPolicyName policyName, LongTermRetentionPolicyData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + LongTermRetentionPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionPolicyData.DeserializeLongTermRetentionPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LongTermRetentionPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -232,71 +229,74 @@ internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string r uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/backupLongTermRetentionPolicies", false); + uri.AppendPath("/backupLongTermRetentionPolicies/", false); + uri.AppendPath(policyName.ToString(), 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; } - /// Gets a database's long term retention policy. + /// Set or update a database's long term retention policy. /// 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 policy name. Should always be Default. + /// The long term retention policy info. /// 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> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - LongTermRetentionPolicyListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets a database's long term retention policy. + /// Set or update a database's long term retention policy. /// 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 policy name. Should always be Default. + /// The long term retention policy info. /// 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 ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, policyName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - LongTermRetentionPolicyListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs index efaf5008d9326..22504d56f9104 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs @@ -452,55 +452,6 @@ public virtual Response GetDataWarehouseUserA return GetDataWarehouseUserActivities().Get(dataWarehouseUserActivityName, cancellationToken); } - /// Gets a collection of LongTermRetentionPolicyResources in the SqlDatabase. - /// An object representing collection of LongTermRetentionPolicyResources and their operations over a LongTermRetentionPolicyResource. - public virtual LongTermRetentionPolicyCollection GetLongTermRetentionPolicies() - { - return GetCachedClient(client => new LongTermRetentionPolicyCollection(client, Id)); - } - - /// - /// Gets a database's long term retention policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} - /// - /// - /// Operation Id - /// LongTermRetentionPolicies_Get - /// - /// - /// - /// The policy name. Should always be Default. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual async Task> GetLongTermRetentionPolicyAsync(LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) - { - return await GetLongTermRetentionPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a database's long term retention policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} - /// - /// - /// Operation Id - /// LongTermRetentionPolicies_Get - /// - /// - /// - /// The policy name. Should always be Default. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual Response GetLongTermRetentionPolicy(LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) - { - return GetLongTermRetentionPolicies().Get(policyName, cancellationToken); - } - /// Gets an object representing a MaintenanceWindowOptionResource along with the instance operations that can be performed on it in the SqlDatabase. /// Returns a object. public virtual MaintenanceWindowOptionResource GetMaintenanceWindowOption() @@ -1070,6 +1021,55 @@ public virtual Response GetSqlDat return GetSqlDatabaseSqlVulnerabilityAssessments().Get(vulnerabilityAssessmentName, cancellationToken); } + /// Gets a collection of LongTermRetentionPolicyResources in the SqlDatabase. + /// An object representing collection of LongTermRetentionPolicyResources and their operations over a LongTermRetentionPolicyResource. + public virtual LongTermRetentionPolicyCollection GetLongTermRetentionPolicies() + { + return GetCachedClient(client => new LongTermRetentionPolicyCollection(client, Id)); + } + + /// + /// Gets a database's long term retention policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// LongTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be Default. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetLongTermRetentionPolicyAsync(LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + return await GetLongTermRetentionPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a database's long term retention policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// LongTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be Default. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetLongTermRetentionPolicy(LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + return GetLongTermRetentionPolicies().Get(policyName, cancellationToken); + } + /// /// Gets a database. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs index 57a80a3736e25..e1a355876ae96 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs @@ -151,6 +151,59 @@ public virtual Response GetSqlServerJobCredentia return GetSqlServerJobCredentials().Get(credentialName, cancellationToken); } + /// Gets a collection of JobPrivateEndpointResources in the SqlServerJobAgent. + /// An object representing collection of JobPrivateEndpointResources and their operations over a JobPrivateEndpointResource. + public virtual JobPrivateEndpointCollection GetJobPrivateEndpoints() + { + return GetCachedClient(client => new JobPrivateEndpointCollection(client, Id)); + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetJobPrivateEndpointAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + return await GetJobPrivateEndpoints().GetAsync(privateEndpointName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetJobPrivateEndpoint(string privateEndpointName, CancellationToken cancellationToken = default) + { + return GetJobPrivateEndpoints().Get(privateEndpointName, cancellationToken); + } + /// Gets a collection of SqlServerJobResources in the SqlServerJobAgent. /// An object representing collection of SqlServerJobResources and their operations over a SqlServerJobResource. public virtual SqlServerJobCollection GetSqlServerJobs() diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs index 39c5a736d31a6..901b0f4ae9adf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs @@ -225,6 +225,82 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } } + /// + /// Change a long term retention backup access tier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/changeAccessTier + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ChangeAccessTier + /// + /// + /// + /// 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 to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> ChangeAccessTierAsync(WaitUntil waitUntil, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); + + using var scope = _subscriptionLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionLongTermRetentionBackupResource.ChangeAccessTier"); + scope.Start(); + try + { + var response = await _subscriptionLongTermRetentionBackupLongTermRetentionBackupsRestClient.ChangeAccessTierAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new SubscriptionLongTermRetentionBackupOperationSource(Client), _subscriptionLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics, Pipeline, _subscriptionLongTermRetentionBackupLongTermRetentionBackupsRestClient.CreateChangeAccessTierRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Change a long term retention backup access tier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/changeAccessTier + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ChangeAccessTier + /// + /// + /// + /// 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 to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ChangeAccessTier(WaitUntil waitUntil, ChangeLongTermRetentionBackupAccessTierParameters changeLongTermRetentionBackupAccessTierParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(changeLongTermRetentionBackupAccessTierParameters, nameof(changeLongTermRetentionBackupAccessTierParameters)); + + using var scope = _subscriptionLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionLongTermRetentionBackupResource.ChangeAccessTier"); + scope.Start(); + try + { + var response = _subscriptionLongTermRetentionBackupLongTermRetentionBackupsRestClient.ChangeAccessTier(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters, cancellationToken); + var operation = new SqlArmOperation(new SubscriptionLongTermRetentionBackupOperationSource(Client), _subscriptionLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics, Pipeline, _subscriptionLongTermRetentionBackupLongTermRetentionBackupsRestClient.CreateChangeAccessTierRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Parent.Name), Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, changeLongTermRetentionBackupAccessTierParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Copy an existing long term retention backup. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index c29f3445593f8..006c5b964df69 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md @@ -5,7 +5,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true tag: package-composite-v5 -require: https://github.com/Azure/azure-rest-api-specs/blob/fb1e2c65b2dd52ebb18bb835a3d0f0289875858e/specification/sql/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sql/resource-manager/readme.md namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated clear-output-folder: true