From 1ced2accc096183f8acbb5e8a9b2d1e6ceebfe4d Mon Sep 17 00:00:00 2001 From: Ayush Gupta - SQL <166794972+guptaayush007@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:45:11 +0530 Subject: [PATCH] [SQL] Generating the .NET Sdk for adding manual cutover and OperationPhaseDetails parameter In forward Migration v2 workflow for Migrating Azure sterling Db to azure Hyperscale DB (#44470) --- .../Azure.ResourceManager.Sql/CHANGELOG.md | 24 +- ...zure.ResourceManager.Sql.netstandard2.0.cs | 77 +++- .../Samples/Sample_FailoverGroupCollection.cs | 66 ++- .../Samples/Sample_FailoverGroupResource.cs | 57 ++- .../Samples/Sample_SqlDatabaseResource.cs | 120 +++--- ...ServerDatabaseReplicationLinkCollection.cs | 50 ++- ...qlServerDatabaseReplicationLinkResource.cs | 47 ++- .../Samples/Sample_SqlServerResource.cs | 68 +-- .../src/Generated/ArmSqlModelFactory.cs | 201 +++++---- .../Extensions/MockableSqlArmClient.cs | 24 +- .../src/Generated/Extensions/SqlExtensions.cs | 38 +- .../src/Generated/FailoverGroupCollection.cs | 20 +- .../FailoverGroupData.Serialization.cs | 31 ++ .../src/Generated/FailoverGroupData.cs | 7 +- .../src/Generated/FailoverGroupResource.cs | 36 +- .../DatabaseOperationData.Serialization.cs | 31 ++ .../Generated/Models/DatabaseOperationData.cs | 7 +- .../Models/DatabaseOperationPhase.cs | 57 +++ ...baseOperationPhaseDetails.Serialization.cs | 223 ++++++++++ .../Models/DatabaseOperationPhaseDetails.cs | 72 ++++ .../FailoverGroupDatabasesSecondaryType.cs | 51 +++ .../FailoverGroupPatch.Serialization.cs | 16 + .../Generated/Models/FailoverGroupPatch.cs | 7 +- .../Generated/Models/ReplicationLinkType.cs | 2 +- ...abaseReplicationLinkPatch.Serialization.cs | 285 +++++++++++++ .../SqlServerDatabaseReplicationLinkPatch.cs | 72 ++++ .../RestOperations/DatabaseRestOperations.cs | 88 ++-- .../FailoverGroupsRestOperations.cs | 2 +- .../ReplicationLinksRestOperations.cs | 218 +++++++++- .../src/Generated/SqlDatabaseResource.cs | 390 +++++++++--------- ...ServerDatabaseReplicationLinkCollection.cs | 114 ++++- ...tabaseReplicationLinkData.Serialization.cs | 37 +- .../SqlServerDatabaseReplicationLinkData.cs | 13 +- ...qlServerDatabaseReplicationLinkResource.cs | 109 ++++- .../src/Generated/SqlServerResource.cs | 134 +++--- .../Azure.ResourceManager.Sql/src/autorest.md | 12 +- 36 files changed, 2198 insertions(+), 608 deletions(-) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhase.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupDatabasesSecondaryType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.cs diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/CHANGELOG.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/CHANGELOG.md index 7218b46193891..211ccf1149b4f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/CHANGELOG.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/CHANGELOG.md @@ -1,15 +1,15 @@ # Release History -## 1.3.0-beta.9 (Unreleased) +## 1.3.0-beta.9 (2024-07-15) ### Features Added -### Breaking Changes - -### Bugs Fixed +- Upgraded api-version tag to latest 'composite-v5'. Tag detail available at https://github.com/Azure/azure-rest-api-specs/blob/f45a76fc39f033947ed12faf4b6416e1e19724cd/specification/sql/resource-manager/readme.md. ### Other Changes +- Upgraded Azure.Core from 1.39.0 to 1.40.0 + ## 1.3.0-beta.8 (2024-05-07) ### Bugs Fixed @@ -20,7 +20,7 @@ ### Features Added -- Add `ArmOperation.Rehydrate` and `ArmOperation.Rehydrate` static methods to rehydrate a long-running operation. +- Added `ArmOperation.Rehydrate` and `ArmOperation.Rehydrate` static methods to rehydrate a long-running operation. ## 1.3.0-beta.6 (2024-03-26) @@ -32,14 +32,14 @@ ### Features Added -- Enable the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. +- Enabled the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. - Added TLS 1.3 to list of valid TLS versions. Also created custom classes needed since the type of MinimalTlsVersion was changed from String to Enum. ## 1.3.0-beta.4 (2023-11-21) ### Features Added -- Enable mocking for extension methods, refer this [document](https://aka.ms/azsdk/net/mocking) for more details. +- Enabled mocking for extension methods, refer this [document](https://aka.ms/azsdk/net/mocking) for more details. ### Other Changes @@ -65,7 +65,7 @@ ### Features Added -- Enable the model factory feature for model mocking, more information can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-mocking-factory-builder). +- Enabled the model factory feature for model mocking, more information can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-mocking-factory-builder). - Added support for `ManagedInstanceServerConfigurationOption`, `ManagedInstanceStartStopSchedule` and `ManagedLedgerDigestUpload` resources. - Added `filter` and `expand` parameters to `Get` and `Exists` methods of `RestorableDroppedDatabaseCollection` and `SqlDatabaseCollection`. - Added `filter` and `expand` parameters to `Get` methods of `RestorableDroppedDatabaseResource` and `SqlDatabaseResource`. @@ -147,12 +147,12 @@ Polishing since last public beta release: ### Features Added -- Add Update methods in resource classes. +- Added Update methods in resource classes. ### Breaking Changes -- Rename private endpoint resource names with `Sql` prefix. -- Rename `PrivateLinkServiceConnectionState` properties to `ConnectionState`. +- Renamed private endpoint resource names with `Sql` prefix. +- Renamed `PrivateLinkServiceConnectionState` properties to `ConnectionState`. ### Bugs Fixed @@ -226,4 +226,4 @@ This package follows the [new Azure SDK guidelines](https://azure.github.io/azur This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). -> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file 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 74a6da02aede1..8a231beb90860 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 @@ -636,6 +636,7 @@ public FailoverGroupData() { } public Azure.ResourceManager.Sql.Models.FailoverGroupReadWriteEndpoint ReadWriteEndpoint { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.FailoverGroupReplicationRole? ReplicationRole { get { throw null; } } public string ReplicationState { get { throw null; } } + public Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType? SecondaryType { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } Azure.ResourceManager.Sql.FailoverGroupData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -4847,6 +4848,8 @@ public SqlServerData(Azure.Core.AzureLocation location) { } public partial class SqlServerDatabaseReplicationLinkCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected SqlServerDatabaseReplicationLinkCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string linkId, Azure.ResourceManager.Sql.SqlServerDatabaseReplicationLinkData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string linkId, Azure.ResourceManager.Sql.SqlServerDatabaseReplicationLinkData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Exists(string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ExistsAsync(string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -4863,8 +4866,9 @@ public partial class SqlServerDatabaseReplicationLinkData : Azure.ResourceManage { public SqlServerDatabaseReplicationLinkData() { } public bool? IsTerminationAllowed { get { throw null; } } - public Azure.ResourceManager.Sql.Models.ReplicationLinkType? LinkType { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ReplicationLinkType? LinkType { get { throw null; } set { } } public string PartnerDatabase { get { throw null; } } + public string PartnerDatabaseId { get { throw null; } } public Azure.Core.AzureLocation? PartnerLocation { get { throw null; } } public Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole? PartnerRole { get { throw null; } } public string PartnerServer { get { throw null; } } @@ -4899,6 +4903,8 @@ protected SqlServerDatabaseReplicationLinkResource() { } Azure.ResourceManager.Sql.SqlServerDatabaseReplicationLinkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationLinkPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationLinkPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class SqlServerDatabaseRestorePointCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -6991,7 +6997,8 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.DatabaseExportDefinition DatabaseExportDefinition(Azure.ResourceManager.Sql.Models.StorageKeyType storageKeyType = default(Azure.ResourceManager.Sql.Models.StorageKeyType), string storageKey = null, System.Uri storageUri = null, string administratorLogin = null, string administratorLoginPassword = null, string authenticationType = null, Azure.ResourceManager.Sql.Models.NetworkIsolationSettings networkIsolation = null) { throw null; } public static Azure.ResourceManager.Sql.Models.DatabaseIdentity DatabaseIdentity(Azure.ResourceManager.Sql.Models.DatabaseIdentityType? identityType = default(Azure.ResourceManager.Sql.Models.DatabaseIdentityType?), System.Guid? tenantId = default(System.Guid?), System.Collections.Generic.IDictionary userAssignedIdentities = null) { throw null; } public static Azure.ResourceManager.Sql.Models.DatabaseImportDefinition DatabaseImportDefinition(string databaseName = null, string edition = null, string serviceObjectiveName = null, string maxSizeBytes = null, Azure.ResourceManager.Sql.Models.StorageKeyType storageKeyType = default(Azure.ResourceManager.Sql.Models.StorageKeyType), string storageKey = null, System.Uri storageUri = null, string administratorLogin = null, string administratorLoginPassword = null, string authenticationType = null, Azure.ResourceManager.Sql.Models.NetworkIsolationSettings networkIsolation = null) { throw null; } - public static Azure.ResourceManager.Sql.Models.DatabaseOperationData DatabaseOperationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string databaseName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = default(int?), string serverName = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagementOperationState? state = default(Azure.ResourceManager.Sql.Models.ManagementOperationState?), int? errorCode = default(int?), string errorDescription = null, int? errorSeverity = default(int?), bool? isUserError = default(bool?), System.DateTimeOffset? estimatedCompleteOn = default(System.DateTimeOffset?), string description = null, bool? isCancellable = default(bool?)) { throw null; } + public static Azure.ResourceManager.Sql.Models.DatabaseOperationData DatabaseOperationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string databaseName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = default(int?), string serverName = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagementOperationState? state = default(Azure.ResourceManager.Sql.Models.ManagementOperationState?), int? errorCode = default(int?), string errorDescription = null, int? errorSeverity = default(int?), bool? isUserError = default(bool?), System.DateTimeOffset? estimatedCompleteOn = default(System.DateTimeOffset?), string description = null, bool? isCancellable = default(bool?), Azure.ResourceManager.Sql.Models.DatabaseOperationPhaseDetails operationPhaseDetails = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.DatabaseOperationPhaseDetails DatabaseOperationPhaseDetails(Azure.ResourceManager.Sql.Models.DatabaseOperationPhase? phase = default(Azure.ResourceManager.Sql.Models.DatabaseOperationPhase?), System.Collections.Generic.IReadOnlyDictionary phaseInformation = null) { throw null; } public static Azure.ResourceManager.Sql.DatabaseSchemaData DatabaseSchemaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null) { throw null; } public static Azure.ResourceManager.Sql.DatabaseTableData DatabaseTableData(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.TableTemporalType? temporalType = default(Azure.ResourceManager.Sql.Models.TableTemporalType?), bool? isMemoryOptimized = default(bool?)) { throw null; } public static Azure.ResourceManager.Sql.Models.DatabaseUsage DatabaseUsage(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string displayName = null, double? currentValue = default(double?), double? limit = default(double?), string unit = null) { throw null; } @@ -7016,7 +7023,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.EndpointCertificateData EndpointCertificateData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string publicBlob = null) { throw null; } public static Azure.ResourceManager.Sql.ExtendedDatabaseBlobAuditingPolicyData ExtendedDatabaseBlobAuditingPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string predicateExpression = null, int? retentionDays = default(int?), System.Collections.Generic.IEnumerable auditActionsAndGroups = null, bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), bool? isManagedIdentityInUse = default(bool?), Azure.ResourceManager.Sql.Models.BlobAuditingPolicyState? state = default(Azure.ResourceManager.Sql.Models.BlobAuditingPolicyState?), string storageEndpoint = null, string storageAccountAccessKey = null, System.Guid? storageAccountSubscriptionId = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.Sql.ExtendedServerBlobAuditingPolicyData ExtendedServerBlobAuditingPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? isDevopsAuditEnabled = default(bool?), string predicateExpression = null, int? retentionDays = default(int?), System.Collections.Generic.IEnumerable auditActionsAndGroups = null, bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), bool? isManagedIdentityInUse = default(bool?), Azure.ResourceManager.Sql.Models.BlobAuditingPolicyState? state = default(Azure.ResourceManager.Sql.Models.BlobAuditingPolicyState?), string storageEndpoint = null, string storageAccountAccessKey = null, System.Guid? storageAccountSubscriptionId = default(System.Guid?)) { throw null; } - public static Azure.ResourceManager.Sql.FailoverGroupData FailoverGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Sql.Models.FailoverGroupReadWriteEndpoint readWriteEndpoint = null, Azure.ResourceManager.Sql.Models.FailoverGroupReadOnlyEndpoint readOnlyEndpoint = null, Azure.ResourceManager.Sql.Models.FailoverGroupReplicationRole? replicationRole = default(Azure.ResourceManager.Sql.Models.FailoverGroupReplicationRole?), string replicationState = null, System.Collections.Generic.IEnumerable partnerServers = null, System.Collections.Generic.IEnumerable failoverDatabases = null) { throw null; } + public static Azure.ResourceManager.Sql.FailoverGroupData FailoverGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Sql.Models.FailoverGroupReadWriteEndpoint readWriteEndpoint = null, Azure.ResourceManager.Sql.Models.FailoverGroupReadOnlyEndpoint readOnlyEndpoint = null, Azure.ResourceManager.Sql.Models.FailoverGroupReplicationRole? replicationRole = default(Azure.ResourceManager.Sql.Models.FailoverGroupReplicationRole?), string replicationState = null, System.Collections.Generic.IEnumerable partnerServers = null, System.Collections.Generic.IEnumerable failoverDatabases = null, Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType? secondaryType = default(Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType?)) { throw null; } public static Azure.ResourceManager.Sql.GeoBackupPolicyData GeoBackupPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string kind = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Sql.Models.GeoBackupPolicyState state = Azure.ResourceManager.Sql.Models.GeoBackupPolicyState.Disabled, string storageType = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ImportExistingDatabaseDefinition ImportExistingDatabaseDefinition(Azure.ResourceManager.Sql.Models.StorageKeyType storageKeyType = default(Azure.ResourceManager.Sql.Models.StorageKeyType), string storageKey = null, System.Uri storageUri = null, string administratorLogin = null, string administratorLoginPassword = null, string authenticationType = null, Azure.ResourceManager.Sql.Models.NetworkIsolationSettings networkIsolation = null) { throw null; } 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; } @@ -7152,7 +7159,8 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.SqlServerCommunicationLinkData SqlServerCommunicationLinkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string kind = null, string state = null, string partnerServer = null) { throw null; } public static Azure.ResourceManager.Sql.SqlServerConnectionPolicyData SqlServerConnectionPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string kind = null, Azure.ResourceManager.Sql.Models.ServerConnectionType? connectionType = default(Azure.ResourceManager.Sql.Models.ServerConnectionType?)) { throw null; } public static Azure.ResourceManager.Sql.SqlServerData SqlServerData(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.Models.ManagedServiceIdentity identity = null, string kind = null, string administratorLogin = null, string administratorLoginPassword = null, string version = null, string state = null, string fullyQualifiedDomainName = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.Sql.Models.SqlMinimalTlsVersion? minTlsVersion = default(Azure.ResourceManager.Sql.Models.SqlMinimalTlsVersion?), Azure.ResourceManager.Sql.Models.ServerNetworkAccessFlag? publicNetworkAccess = default(Azure.ResourceManager.Sql.Models.ServerNetworkAccessFlag?), Azure.ResourceManager.Sql.Models.ServerWorkspaceFeature? workspaceFeature = default(Azure.ResourceManager.Sql.Models.ServerWorkspaceFeature?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Guid? federatedClientId = default(System.Guid?), System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ServerExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.ServerNetworkAccessFlag? restrictOutboundNetworkAccess = default(Azure.ResourceManager.Sql.Models.ServerNetworkAccessFlag?), Azure.ResourceManager.Sql.Models.ServerNetworkAccessFlag? isIPv6Enabled = default(Azure.ResourceManager.Sql.Models.ServerNetworkAccessFlag?), Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? externalGovernanceStatus = default(Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus?)) { throw null; } - public static Azure.ResourceManager.Sql.SqlServerDatabaseReplicationLinkData SqlServerDatabaseReplicationLinkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string partnerServer = null, string partnerDatabase = null, Azure.Core.AzureLocation? partnerLocation = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole? role = default(Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole?), Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole? partnerRole = default(Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole?), string replicationMode = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), int? percentComplete = default(int?), Azure.ResourceManager.Sql.Models.ReplicationLinkState? replicationState = default(Azure.ResourceManager.Sql.Models.ReplicationLinkState?), bool? isTerminationAllowed = default(bool?), Azure.ResourceManager.Sql.Models.ReplicationLinkType? linkType = default(Azure.ResourceManager.Sql.Models.ReplicationLinkType?)) { throw null; } + public static Azure.ResourceManager.Sql.SqlServerDatabaseReplicationLinkData SqlServerDatabaseReplicationLinkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string partnerServer = null, string partnerDatabase = null, string partnerDatabaseId = null, Azure.Core.AzureLocation? partnerLocation = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole? role = default(Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole?), Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole? partnerRole = default(Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationRole?), string replicationMode = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), int? percentComplete = default(int?), Azure.ResourceManager.Sql.Models.ReplicationLinkState? replicationState = default(Azure.ResourceManager.Sql.Models.ReplicationLinkState?), bool? isTerminationAllowed = default(bool?), Azure.ResourceManager.Sql.Models.ReplicationLinkType? linkType = default(Azure.ResourceManager.Sql.Models.ReplicationLinkType?)) { throw null; } + public static Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationLinkPatch SqlServerDatabaseReplicationLinkPatch(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.ReplicationLinkType? linkType = default(Azure.ResourceManager.Sql.Models.ReplicationLinkType?)) { throw null; } public static Azure.ResourceManager.Sql.SqlServerDatabaseRestorePointData SqlServerDatabaseRestorePointData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Sql.Models.RestorePointType? restorePointType = default(Azure.ResourceManager.Sql.Models.RestorePointType?), System.DateTimeOffset? earliestRestoreOn = default(System.DateTimeOffset?), System.DateTimeOffset? restorePointCreatedOn = default(System.DateTimeOffset?), string restorePointLabel = null) { throw null; } public static Azure.ResourceManager.Sql.SqlServerDevOpsAuditingSettingData SqlServerDevOpsAuditingSettingData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? isAzureMonitorTargetEnabled = default(bool?), bool? isManagedIdentityInUse = default(bool?), Azure.ResourceManager.Sql.Models.BlobAuditingPolicyState? state = default(Azure.ResourceManager.Sql.Models.BlobAuditingPolicyState?), string storageEndpoint = null, string storageAccountAccessKey = null, System.Guid? storageAccountSubscriptionId = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.Sql.SqlServerDnsAliasData SqlServerDnsAliasData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string azureDnsRecord = null) { throw null; } @@ -7540,6 +7548,7 @@ public DatabaseOperationData() { } public bool? IsUserError { get { throw null; } } public string Operation { get { throw null; } } public string OperationFriendlyName { get { throw null; } } + public Azure.ResourceManager.Sql.Models.DatabaseOperationPhaseDetails OperationPhaseDetails { get { throw null; } } public int? PercentComplete { get { throw null; } } public string ServerName { get { throw null; } } public System.DateTimeOffset? StartOn { get { throw null; } } @@ -7551,6 +7560,37 @@ public DatabaseOperationData() { } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DatabaseOperationPhase : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseOperationPhase(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.DatabaseOperationPhase Catchup { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.DatabaseOperationPhase Copying { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.DatabaseOperationPhase CutoverInProgress { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.DatabaseOperationPhase WaitingForCutover { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.DatabaseOperationPhase 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.DatabaseOperationPhase left, Azure.ResourceManager.Sql.Models.DatabaseOperationPhase right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.DatabaseOperationPhase (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.DatabaseOperationPhase left, Azure.ResourceManager.Sql.Models.DatabaseOperationPhase right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DatabaseOperationPhaseDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DatabaseOperationPhaseDetails() { } + public Azure.ResourceManager.Sql.Models.DatabaseOperationPhase? Phase { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary PhaseInformation { get { throw null; } } + Azure.ResourceManager.Sql.Models.DatabaseOperationPhaseDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DatabaseOperationPhaseDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DatabaseReadScale : System.IEquatable { private readonly object _dummy; @@ -7989,6 +8029,24 @@ internal ElasticPoolPerformanceLevelCapability() { } public static bool operator !=(Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus left, Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FailoverGroupDatabasesSecondaryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FailoverGroupDatabasesSecondaryType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType Geo { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType Standby { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType 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.FailoverGroupDatabasesSecondaryType left, Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType left, Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType right) { throw null; } + public override string ToString() { throw null; } + } public partial class FailoverGroupPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public FailoverGroupPatch() { } @@ -8001,6 +8059,7 @@ public FailoverGroupPatch() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public Azure.ResourceManager.Sql.Models.ReadOnlyEndpointFailoverPolicy? ReadOnlyEndpointFailoverPolicy { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.FailoverGroupReadWriteEndpoint ReadWriteEndpoint { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.FailoverGroupDatabasesSecondaryType? SecondaryType { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } Azure.ResourceManager.Sql.Models.FailoverGroupPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -10960,6 +11019,16 @@ public SqlScheduleItem(Azure.ResourceManager.Sql.Models.SqlDayOfWeek startDay, s public static bool operator !=(Azure.ResourceManager.Sql.Models.SqlSecurityAlertPolicyName left, Azure.ResourceManager.Sql.Models.SqlSecurityAlertPolicyName right) { throw null; } public override string ToString() { throw null; } } + public partial class SqlServerDatabaseReplicationLinkPatch : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SqlServerDatabaseReplicationLinkPatch() { } + public Azure.ResourceManager.Sql.Models.ReplicationLinkType? LinkType { get { throw null; } set { } } + Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationLinkPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.SqlServerDatabaseReplicationLinkPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public enum SqlServerDatabaseReplicationRole { Primary = 0, diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs index d89edac6b97b0..8ef1b245ddce3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_FailoverGroupCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupList.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupList.json // this example is just showing the usage of "FailoverGroups_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 @@ -57,7 +57,7 @@ public async Task GetAll_ListFailoverGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupGet.json // this example is just showing the usage of "FailoverGroups_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 @@ -92,7 +92,7 @@ public async Task Get_GetFailoverGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupGet.json // this example is just showing the usage of "FailoverGroups_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 @@ -123,7 +123,7 @@ public async Task Exists_GetFailoverGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupGet.json // this example is just showing the usage of "FailoverGroups_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 @@ -166,7 +166,7 @@ public async Task GetIfExists_GetFailoverGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupCreateOrUpdate.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupCreateOrUpdate.json // this example is just showing the usage of "FailoverGroups_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 @@ -215,5 +215,61 @@ public async Task CreateOrUpdate_CreateFailoverGroup() // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + + // Create failover group with standby secondary database on partner server. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateFailoverGroupWithStandbySecondaryDatabaseOnPartnerServer() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupCreateOrUpdateStandbySecondary.json + // this example is just showing the usage of "FailoverGroups_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "failover-group-primary-server"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this FailoverGroupResource + FailoverGroupCollection collection = sqlServer.GetFailoverGroups(); + + // invoke the operation + string failoverGroupName = "failover-group-test-3"; + FailoverGroupData data = new FailoverGroupData() + { + ReadWriteEndpoint = new FailoverGroupReadWriteEndpoint(ReadWriteEndpointFailoverPolicy.Automatic) + { + FailoverWithDataLossGracePeriodMinutes = 480, + }, + ReadOnlyEndpoint = new FailoverGroupReadOnlyEndpoint() + { + FailoverPolicy = ReadOnlyEndpointFailoverPolicy.Disabled, + }, + PartnerServers = +{ +new PartnerServerInfo(new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server")) +}, + FailoverDatabases = +{ +new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1"),new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-2") +}, + SecondaryType = FailoverGroupDatabasesSecondaryType.Standby, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, failoverGroupName, data); + FailoverGroupResource 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 + FailoverGroupData 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_FailoverGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupResource.cs index ce916de1687f1..871e0e5e48d1f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupResource.cs @@ -20,7 +20,7 @@ public partial class Sample_FailoverGroupResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupGet.json // this example is just showing the usage of "FailoverGroups_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 @@ -52,7 +52,7 @@ public async Task Get_GetFailoverGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupDelete.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupDelete.json // this example is just showing the usage of "FailoverGroups_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 @@ -75,12 +75,57 @@ public async Task Delete_DeleteFailoverGroup() Console.WriteLine($"Succeeded"); } + // Add database to failover group with standby secondary on partner server. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_AddDatabaseToFailoverGroupWithStandbySecondaryOnPartnerServer() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupUpdateStandbySecondary.json + // this example is just showing the usage of "FailoverGroups_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 FailoverGroupResource created on azure + // for more information of creating FailoverGroupResource, please refer to the document of FailoverGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "failover-group-primary-server"; + string failoverGroupName = "failover-group-test-1"; + ResourceIdentifier failoverGroupResourceId = FailoverGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, failoverGroupName); + FailoverGroupResource failoverGroup = client.GetFailoverGroupResource(failoverGroupResourceId); + + // invoke the operation + FailoverGroupPatch patch = new FailoverGroupPatch() + { + ReadWriteEndpoint = new FailoverGroupReadWriteEndpoint(ReadWriteEndpointFailoverPolicy.Automatic) + { + FailoverWithDataLossGracePeriodMinutes = 120, + }, + FailoverDatabases = +{ +new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1") +}, + SecondaryType = FailoverGroupDatabasesSecondaryType.Standby, + }; + ArmOperation lro = await failoverGroup.UpdateAsync(WaitUntil.Completed, patch); + FailoverGroupResource 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 + FailoverGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Update failover group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupUpdate.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupUpdate.json // this example is just showing the usage of "FailoverGroups_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 @@ -124,7 +169,7 @@ public async Task Update_UpdateFailoverGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Failover_PlannedFailoverOfAFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupFailover.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupFailover.json // this example is just showing the usage of "FailoverGroups_Failover" 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 @@ -157,7 +202,7 @@ public async Task Failover_PlannedFailoverOfAFailoverGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ForceFailoverAllowDataLoss_ForcedFailoverOfAFailoverGroupAllowingDataLoss() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupForceFailoverAllowDataLoss.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupForceFailoverAllowDataLoss.json // this example is just showing the usage of "FailoverGroups_ForceFailoverAllowDataLoss" 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 @@ -190,7 +235,7 @@ public async Task ForceFailoverAllowDataLoss_ForcedFailoverOfAFailoverGroupAllow [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task TryPlannedBeforeForcedFailover_TryPlannedBeforeForcedFailoverOfAFailoverGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-02-01-preview/examples/FailoverGroupTryPlannedBeforeForcedFailover.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverGroupTryPlannedBeforeForcedFailover.json // this example is just showing the usage of "FailoverGroups_TryPlannedBeforeForcedFailover" 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 diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseResource.cs index a5cfc582e8d56..fa4730591372a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseResource.cs @@ -268,66 +268,6 @@ public async Task GetDatabaseExtensions_ListDatabaseExtensions() Console.WriteLine($"Succeeded"); } - // Cancel the database management operation - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CancelDatabaseOperation_CancelTheDatabaseManagementOperation() - { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CancelDatabaseOperation.json - // this example is just showing the usage of "DatabaseOperations_Cancel" 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 = "sqlcrudtest-7398"; - string serverName = "sqlcrudtest-6661"; - string databaseName = "testdb"; - ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); - SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); - - // invoke the operation - Guid operationId = Guid.Parse("f779414b-e748-4925-8cfe-c8598f7660ae"); - await sqlDatabase.CancelDatabaseOperationAsync(operationId); - - Console.WriteLine($"Succeeded"); - } - - // List the database management operations - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetDatabaseOperations_ListTheDatabaseManagementOperations() - { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseOperations.json - // this example is just showing the usage of "DatabaseOperations_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 = "sqlcrudtest-7398"; - string serverName = "sqlcrudtest-4645"; - string databaseName = "testdb"; - ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); - SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); - - // invoke the operation and iterate over the result - await foreach (DatabaseOperationData item in sqlDatabase.GetDatabaseOperationsAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - // Gets database usages. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1366,5 +1306,65 @@ public async Task UpgradeDataWarehouse_UpgradesADataWarehouse() Console.WriteLine($"Succeeded"); } + + // List the database management operations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDatabaseOperations_ListTheDatabaseManagementOperations() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/ListDatabaseOperations.json + // this example is just showing the usage of "DatabaseOperations_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 = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // invoke the operation and iterate over the result + await foreach (DatabaseOperationData item in sqlDatabase.GetDatabaseOperationsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Cancel the database management operation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CancelDatabaseOperation_CancelTheDatabaseManagementOperation() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/CancelDatabaseOperation.json + // this example is just showing the usage of "DatabaseOperations_Cancel" 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 = "sqlcrudtest-7398"; + string serverName = "sqlcrudtest-6661"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // invoke the operation + Guid operationId = Guid.Parse("f779414b-e748-4925-8cfe-c8598f7660ae"); + await sqlDatabase.CancelDatabaseOperationAsync(operationId); + + Console.WriteLine($"Succeeded"); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs index 1e48f5e0ddbbc..fd83d4e4d8c54 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql.Samples { @@ -19,7 +20,7 @@ public partial class Sample_SqlServerDatabaseReplicationLinkCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListReplicationLinksOnServerOnDatabase() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkListByDatabase.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkListByDatabase.json // this example is just showing the usage of "ReplicationLinks_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 @@ -57,7 +58,7 @@ public async Task GetAll_ListReplicationLinksOnServerOnDatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetsTheReplicationLink() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkGet.json // this example is just showing the usage of "ReplicationLinks_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 @@ -93,7 +94,7 @@ public async Task Get_GetsTheReplicationLink() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetsTheReplicationLink() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkGet.json // this example is just showing the usage of "ReplicationLinks_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 @@ -125,7 +126,7 @@ public async Task Exists_GetsTheReplicationLink() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetsTheReplicationLink() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkGet.json // this example is just showing the usage of "ReplicationLinks_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 @@ -163,5 +164,46 @@ public async Task GetIfExists_GetsTheReplicationLink() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } } + + // Updates Replication Link + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_UpdatesReplicationLink() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkCreateOrUpdate.json + // this example is just showing the usage of "ReplicationLinks_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 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 = "Default"; + string serverName = "sourcesvr"; + string databaseName = "gamma-db"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlServerDatabaseReplicationLinkResource + SqlServerDatabaseReplicationLinkCollection collection = sqlDatabase.GetSqlServerDatabaseReplicationLinks(); + + // invoke the operation + string linkId = "00000000-1111-2222-3333-666666666666"; + SqlServerDatabaseReplicationLinkData data = new SqlServerDatabaseReplicationLinkData() + { + LinkType = ReplicationLinkType.Standby, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkId, data); + SqlServerDatabaseReplicationLinkResource 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 + SqlServerDatabaseReplicationLinkData 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_SqlServerDatabaseReplicationLinkResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkResource.cs index 284a4b19c55d4..2da4ae0d65d4e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkResource.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql.Samples { @@ -19,7 +20,7 @@ public partial class Sample_SqlServerDatabaseReplicationLinkResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetsTheReplicationLink() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkGet.json // this example is just showing the usage of "ReplicationLinks_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 @@ -52,7 +53,7 @@ public async Task Get_GetsTheReplicationLink() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteReplicationLinkOnServer() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkDelete.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkDelete.json // this example is just showing the usage of "ReplicationLinks_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 @@ -76,12 +77,50 @@ public async Task Delete_DeleteReplicationLinkOnServer() Console.WriteLine($"Succeeded"); } + // Update Replication Link + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateReplicationLink() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkUpdate.json + // this example is just showing the usage of "ReplicationLinks_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 SqlServerDatabaseReplicationLinkResource created on azure + // for more information of creating SqlServerDatabaseReplicationLinkResource, please refer to the document of SqlServerDatabaseReplicationLinkResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "sourcesvr"; + string databaseName = "gamma-db"; + string linkId = "00000000-1111-2222-3333-666666666666"; + ResourceIdentifier sqlServerDatabaseReplicationLinkResourceId = SqlServerDatabaseReplicationLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, linkId); + SqlServerDatabaseReplicationLinkResource sqlServerDatabaseReplicationLink = client.GetSqlServerDatabaseReplicationLinkResource(sqlServerDatabaseReplicationLinkResourceId); + + // invoke the operation + SqlServerDatabaseReplicationLinkPatch patch = new SqlServerDatabaseReplicationLinkPatch() + { + LinkType = ReplicationLinkType.Standby, + }; + ArmOperation lro = await sqlServerDatabaseReplicationLink.UpdateAsync(WaitUntil.Completed, patch); + SqlServerDatabaseReplicationLinkResource 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 + SqlServerDatabaseReplicationLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Planned failover of a replication link [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Failover_PlannedFailoverOfAReplicationLink() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkFailover.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkFailover.json // this example is just showing the usage of "ReplicationLinks_Failover" 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,7 +154,7 @@ public async Task Failover_PlannedFailoverOfAReplicationLink() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task FailoverAllowDataLoss_ForcedFailoverOfAReplicationLink() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkFailoverAllowDataLoss.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkFailoverAllowDataLoss.json // this example is just showing the usage of "ReplicationLinks_FailoverAllowDataLoss" 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 diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerResource.cs index de810029f8387..c7408ec4a04ad 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerResource.cs @@ -107,40 +107,6 @@ public async Task CreateTdeCertificate_UploadATDECertificate() Console.WriteLine($"Succeeded"); } - // List replication links on server - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetReplicationLinks_ListReplicationLinksOnServer() - { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkListByServer.json - // this example is just showing the usage of "ReplicationLinks_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(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SqlServerResource created on azure - // for more information of creating SqlServerResource, please refer to the document of SqlServerResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "Default"; - string serverName = "sourcesvr"; - ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); - SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); - - // invoke the operation and iterate over the result - await foreach (SqlServerDatabaseReplicationLinkResource item in sqlServer.GetReplicationLinksAsync()) - { - // 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 - SqlServerDatabaseReplicationLinkData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - // Gets a list of inaccessible databases in a logical server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -544,5 +510,39 @@ public async Task RefreshStatus_RefreshExternalGovernanceEnablementStatus() Console.WriteLine($"Succeeded: {result}"); } + + // List replication links on server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetReplicationLinks_ListReplicationLinksOnServer() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ReplicationLinkListByServer.json + // this example is just showing the usage of "ReplicationLinks_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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "sourcesvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // invoke the operation and iterate over the result + await foreach (SqlServerDatabaseReplicationLinkResource item in sqlServer.GetReplicationLinksAsync()) + { + // 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 + SqlServerDatabaseReplicationLinkData 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/src/Generated/ArmSqlModelFactory.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs index 4d5f5138622c2..0064125ba412f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs @@ -3080,50 +3080,6 @@ public static ImportExportExtensionsOperationResult ImportExportExtensionsOperat serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The name of the database the operation is being performed on. - /// The name of operation. - /// The friendly name of operation. - /// The percentage of the operation completed. - /// The name of the server. - /// The operation start time. - /// The operation state. - /// The operation error code. - /// The operation error description. - /// The operation error severity. - /// Whether or not the error is a user error. - /// The estimated completion time of the operation. - /// The operation description. - /// Whether the operation can be cancelled. - /// A new instance for mocking. - public static DatabaseOperationData DatabaseOperationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string databaseName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = null, string serverName = null, DateTimeOffset? startOn = null, ManagementOperationState? state = null, int? errorCode = null, string errorDescription = null, int? errorSeverity = null, bool? isUserError = null, DateTimeOffset? estimatedCompleteOn = null, string description = null, bool? isCancellable = null) - { - return new DatabaseOperationData( - id, - name, - resourceType, - systemData, - databaseName, - operation, - operationFriendlyName, - percentComplete, - serverName, - startOn, - state, - errorCode, - errorDescription, - errorSeverity, - isUserError, - estimatedCompleteOn, - description, - isCancellable, - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -4087,44 +4043,6 @@ public static ManagedInstanceAdvancedThreatProtectionData ManagedInstanceAdvance serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Resource partner server. - /// Resource partner database. - /// Resource partner location. - /// Local replication role. - /// Partner replication role. - /// Replication mode. - /// Time at which the link was created. - /// Seeding completion percentage for the link. - /// Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). - /// Whether the user is currently allowed to terminate the link. - /// Link type (GEO, NAMED, STANDBY). - /// A new instance for mocking. - public static SqlServerDatabaseReplicationLinkData SqlServerDatabaseReplicationLinkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string partnerServer = null, string partnerDatabase = null, AzureLocation? partnerLocation = null, SqlServerDatabaseReplicationRole? role = null, SqlServerDatabaseReplicationRole? partnerRole = null, string replicationMode = null, DateTimeOffset? startOn = null, int? percentComplete = null, ReplicationLinkState? replicationState = null, bool? isTerminationAllowed = null, ReplicationLinkType? linkType = null) - { - return new SqlServerDatabaseReplicationLinkData( - id, - name, - resourceType, - systemData, - partnerServer, - partnerDatabase, - partnerLocation, - role, - partnerRole, - replicationMode, - startOn, - percentComplete, - replicationState, - isTerminationAllowed, - linkType, - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -5428,6 +5346,63 @@ public static LogicalDatabaseTransparentDataEncryptionData LogicalDatabaseTransp serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The name of the database the operation is being performed on. + /// The name of operation. + /// The friendly name of operation. + /// The percentage of the operation completed. + /// The name of the server. + /// The operation start time. + /// The operation state. + /// The operation error code. + /// The operation error description. + /// The operation error severity. + /// Whether or not the error is a user error. + /// The estimated completion time of the operation. + /// The operation description. + /// Whether the operation can be cancelled. + /// The operation phase details. + /// A new instance for mocking. + public static DatabaseOperationData DatabaseOperationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string databaseName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = null, string serverName = null, DateTimeOffset? startOn = null, ManagementOperationState? state = null, int? errorCode = null, string errorDescription = null, int? errorSeverity = null, bool? isUserError = null, DateTimeOffset? estimatedCompleteOn = null, string description = null, bool? isCancellable = null, DatabaseOperationPhaseDetails operationPhaseDetails = null) + { + return new DatabaseOperationData( + id, + name, + resourceType, + systemData, + databaseName, + operation, + operationFriendlyName, + percentComplete, + serverName, + startOn, + state, + errorCode, + errorDescription, + errorSeverity, + isUserError, + estimatedCompleteOn, + description, + isCancellable, + operationPhaseDetails, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The operation phase. + /// The operation phase information. + /// A new instance for mocking. + public static DatabaseOperationPhaseDetails DatabaseOperationPhaseDetails(DatabaseOperationPhase? phase = null, IReadOnlyDictionary phaseInformation = null) + { + phaseInformation ??= new Dictionary(); + + return new DatabaseOperationPhaseDetails(phase, phaseInformation, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// Resource ID. /// Resource name. @@ -5744,8 +5719,9 @@ public static SqlVulnerabilityAssessmentData SqlVulnerabilityAssessmentData(Reso /// Replication state of the failover group instance. /// List of partner server information for the failover group. /// List of databases in the failover group. + /// Databases secondary type on partner server. /// A new instance for mocking. - public static FailoverGroupData FailoverGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IDictionary tags = null, FailoverGroupReadWriteEndpoint readWriteEndpoint = null, FailoverGroupReadOnlyEndpoint readOnlyEndpoint = null, FailoverGroupReplicationRole? replicationRole = null, string replicationState = null, IEnumerable partnerServers = null, IEnumerable failoverDatabases = null) + public static FailoverGroupData FailoverGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IDictionary tags = null, FailoverGroupReadWriteEndpoint readWriteEndpoint = null, FailoverGroupReadOnlyEndpoint readOnlyEndpoint = null, FailoverGroupReplicationRole? replicationRole = null, string replicationState = null, IEnumerable partnerServers = null, IEnumerable failoverDatabases = null, FailoverGroupDatabasesSecondaryType? secondaryType = null) { tags ??= new Dictionary(); partnerServers ??= new List(); @@ -5764,6 +5740,7 @@ public static FailoverGroupData FailoverGroupData(ResourceIdentifier id = null, replicationState, partnerServers?.ToList(), failoverDatabases?.ToList(), + secondaryType, serializedAdditionalRawData: null); } @@ -6121,5 +6098,63 @@ public static RefreshExternalGovernanceStatusOperationResult RefreshExternalGove errorMessage, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource partner server. + /// Resource partner database. + /// Resource partner database Id. + /// Resource partner location. + /// Local replication role. + /// Partner replication role. + /// Replication mode. + /// Time at which the link was created. + /// Seeding completion percentage for the link. + /// Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + /// Whether the user is currently allowed to terminate the link. + /// Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. + /// A new instance for mocking. + public static SqlServerDatabaseReplicationLinkData SqlServerDatabaseReplicationLinkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string partnerServer = null, string partnerDatabase = null, string partnerDatabaseId = null, AzureLocation? partnerLocation = null, SqlServerDatabaseReplicationRole? role = null, SqlServerDatabaseReplicationRole? partnerRole = null, string replicationMode = null, DateTimeOffset? startOn = null, int? percentComplete = null, ReplicationLinkState? replicationState = null, bool? isTerminationAllowed = null, ReplicationLinkType? linkType = null) + { + return new SqlServerDatabaseReplicationLinkData( + id, + name, + resourceType, + systemData, + partnerServer, + partnerDatabase, + partnerDatabaseId, + partnerLocation, + role, + partnerRole, + replicationMode, + startOn, + percentComplete, + replicationState, + isTerminationAllowed, + linkType, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. + /// A new instance for mocking. + public static SqlServerDatabaseReplicationLinkPatch SqlServerDatabaseReplicationLinkPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ReplicationLinkType? linkType = null) + { + return new SqlServerDatabaseReplicationLinkPatch( + id, + name, + resourceType, + systemData, + linkType, + serializedAdditionalRawData: null); + } } } 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 1931c1de94434..217cbffe79ea2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs @@ -1162,18 +1162,6 @@ public virtual ManagedInstanceAdvancedThreatProtectionResource GetManagedInstanc return new ManagedInstanceAdvancedThreatProtectionResource(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 SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseReplicationLinkResource(ResourceIdentifier id) - { - SqlServerDatabaseReplicationLinkResource.ValidateResourceId(id); - return new SqlServerDatabaseReplicationLinkResource(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. @@ -1545,5 +1533,17 @@ public virtual SqlServerResource GetSqlServerResource(ResourceIdentifier id) SqlServerResource.ValidateResourceId(id); return new SqlServerResource(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 SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseReplicationLinkResource(ResourceIdentifier id) + { + SqlServerDatabaseReplicationLinkResource.ValidateResourceId(id); + return new SqlServerDatabaseReplicationLinkResource(Client, id); + } } } 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 78750ca35df76..84185a040f19a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -1820,25 +1820,6 @@ public static ManagedInstanceAdvancedThreatProtectionResource GetManagedInstance return GetMockableSqlArmClient(client).GetManagedInstanceAdvancedThreatProtectionResource(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 SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseReplicationLinkResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableSqlArmClient(client).GetSqlServerDatabaseReplicationLinkResource(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. @@ -2428,6 +2409,25 @@ public static SqlServerResource GetSqlServerResource(this ArmClient client, Reso return GetMockableSqlArmClient(client).GetSqlServerResource(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 SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseReplicationLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSqlArmClient(client).GetSqlServerDatabaseReplicationLinkResource(id); + } + /// /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs index 9d9b92ad49a7d..6d4a92a89be86 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> CreateOrUpdateAsy /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wait /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsync(string failo /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string failoverGroupName, Can /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(CancellationToken cancella /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string failoverGroupName, /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string failoverGroupName, CancellationToken /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task> GetIfExistsAs /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.Serialization.cs index 55a036a527fd4..6c7556ba05c84 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.Serialization.cs @@ -113,6 +113,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite } writer.WriteEndArray(); } + if (Optional.IsDefined(SecondaryType)) + { + writer.WritePropertyName("secondaryType"u8); + writer.WriteStringValue(SecondaryType.Value.ToString()); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -164,6 +169,7 @@ internal static FailoverGroupData DeserializeFailoverGroupData(JsonElement eleme string replicationState = default; IList partnerServers = default; IList databases = default; + FailoverGroupDatabasesSecondaryType? secondaryType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -291,6 +297,15 @@ internal static FailoverGroupData DeserializeFailoverGroupData(JsonElement eleme databases = array; continue; } + if (property0.NameEquals("secondaryType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secondaryType = new FailoverGroupDatabasesSecondaryType(property0.Value.GetString()); + continue; + } } continue; } @@ -313,6 +328,7 @@ internal static FailoverGroupData DeserializeFailoverGroupData(JsonElement eleme replicationState, partnerServers ?? new ChangeTrackingList(), databases ?? new ChangeTrackingList(), + secondaryType, serializedAdditionalRawData); } @@ -553,6 +569,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecondaryType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secondaryType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecondaryType)) + { + builder.Append(" secondaryType: "); + builder.AppendLine($"'{SecondaryType.Value.ToString()}'"); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.cs index 1320e51e0261a..9b79b94791ff0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupData.cs @@ -72,8 +72,9 @@ public FailoverGroupData() /// Replication state of the failover group instance. /// List of partner server information for the failover group. /// List of databases in the failover group. + /// Databases secondary type on partner server. /// Keeps track of any properties unknown to the library. - internal FailoverGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IDictionary tags, FailoverGroupReadWriteEndpoint readWriteEndpoint, FailoverGroupReadOnlyEndpoint readOnlyEndpoint, FailoverGroupReplicationRole? replicationRole, string replicationState, IList partnerServers, IList failoverDatabases, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal FailoverGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IDictionary tags, FailoverGroupReadWriteEndpoint readWriteEndpoint, FailoverGroupReadOnlyEndpoint readOnlyEndpoint, FailoverGroupReplicationRole? replicationRole, string replicationState, IList partnerServers, IList failoverDatabases, FailoverGroupDatabasesSecondaryType? secondaryType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Tags = tags; @@ -83,6 +84,7 @@ internal FailoverGroupData(ResourceIdentifier id, string name, ResourceType reso ReplicationState = replicationState; PartnerServers = partnerServers; FailoverDatabases = failoverDatabases; + SecondaryType = secondaryType; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -110,5 +112,8 @@ internal FailoverGroupData(ResourceIdentifier id, string name, ResourceType reso /// List of databases in the failover group. [WirePath("properties.databases")] public IList FailoverDatabases { get; } + /// Databases secondary type on partner server. + [WirePath("properties.secondaryType")] + public FailoverGroupDatabasesSecondaryType? SecondaryType { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs index 17af2d21e8f69..8e7ef1f9ba182 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsync(Cancellation /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationToken cancellatio /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -313,7 +313,7 @@ public virtual async Task> UpdateAsync(WaitU /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -359,7 +359,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, F /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -401,7 +401,7 @@ public virtual async Task> FailoverAsync(Wai /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual ArmOperation Failover(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -485,7 +485,7 @@ public virtual async Task> ForceFailoverAllo /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -527,7 +527,7 @@ public virtual ArmOperation ForceFailoverAllowDataLoss(Wa /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -569,7 +569,7 @@ public virtual async Task> TryPlannedBeforeF /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -611,7 +611,7 @@ public virtual ArmOperation TryPlannedBeforeForcedFailove /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -673,7 +673,7 @@ public virtual async Task> AddTagAsync(string ke /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -735,7 +735,7 @@ public virtual Response AddTag(string key, string value, /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -792,7 +792,7 @@ public virtual async Task> SetTagsAsync(IDiction /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -849,7 +849,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -909,7 +909,7 @@ public virtual async Task> RemoveTagAsync(string /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.Serialization.cs index 78a9d14fca4fd..c37dc99136ad2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.Serialization.cs @@ -120,6 +120,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW writer.WritePropertyName("isCancellable"u8); writer.WriteBooleanValue(IsCancellable.Value); } + if (options.Format != "W" && Optional.IsDefined(OperationPhaseDetails)) + { + writer.WritePropertyName("operationPhaseDetails"u8); + writer.WriteObjectValue(OperationPhaseDetails, options); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -177,6 +182,7 @@ internal static DatabaseOperationData DeserializeDatabaseOperationData(JsonEleme DateTimeOffset? estimatedCompletionTime = default; string description = default; bool? isCancellable = default; + DatabaseOperationPhaseDetails operationPhaseDetails = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -316,6 +322,15 @@ internal static DatabaseOperationData DeserializeDatabaseOperationData(JsonEleme isCancellable = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("operationPhaseDetails"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operationPhaseDetails = DatabaseOperationPhaseDetails.DeserializeDatabaseOperationPhaseDetails(property0.Value, options); + continue; + } } continue; } @@ -344,6 +359,7 @@ internal static DatabaseOperationData DeserializeDatabaseOperationData(JsonEleme estimatedCompletionTime, description, isCancellable, + operationPhaseDetails, serializedAdditionalRawData); } @@ -675,6 +691,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OperationPhaseDetails), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operationPhaseDetails: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OperationPhaseDetails)) + { + builder.Append(" operationPhaseDetails: "); + BicepSerializationHelpers.AppendChildObject(builder, OperationPhaseDetails, options, 4, false, " operationPhaseDetails: "); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.cs index 5544118ed23a9..875f893401b6c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationData.cs @@ -71,8 +71,9 @@ public DatabaseOperationData() /// The estimated completion time of the operation. /// The operation description. /// Whether the operation can be cancelled. + /// The operation phase details. /// Keeps track of any properties unknown to the library. - internal DatabaseOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, string operation, string operationFriendlyName, int? percentComplete, string serverName, DateTimeOffset? startOn, ManagementOperationState? state, int? errorCode, string errorDescription, int? errorSeverity, bool? isUserError, DateTimeOffset? estimatedCompleteOn, string description, bool? isCancellable, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DatabaseOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, string operation, string operationFriendlyName, int? percentComplete, string serverName, DateTimeOffset? startOn, ManagementOperationState? state, int? errorCode, string errorDescription, int? errorSeverity, bool? isUserError, DateTimeOffset? estimatedCompleteOn, string description, bool? isCancellable, DatabaseOperationPhaseDetails operationPhaseDetails, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DatabaseName = databaseName; Operation = operation; @@ -88,6 +89,7 @@ internal DatabaseOperationData(ResourceIdentifier id, string name, ResourceType EstimatedCompleteOn = estimatedCompleteOn; Description = description; IsCancellable = isCancellable; + OperationPhaseDetails = operationPhaseDetails; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -133,5 +135,8 @@ internal DatabaseOperationData(ResourceIdentifier id, string name, ResourceType /// Whether the operation can be cancelled. [WirePath("properties.isCancellable")] public bool? IsCancellable { get; } + /// The operation phase details. + [WirePath("properties.operationPhaseDetails")] + public DatabaseOperationPhaseDetails OperationPhaseDetails { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhase.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhase.cs new file mode 100644 index 0000000000000..c2365bf17e061 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhase.cs @@ -0,0 +1,57 @@ +// 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 operation phase. + public readonly partial struct DatabaseOperationPhase : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatabaseOperationPhase(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CopyingValue = "Copying"; + private const string CatchupValue = "Catchup"; + private const string WaitingForCutoverValue = "WaitingForCutover"; + private const string CutoverInProgressValue = "CutoverInProgress"; + + /// Copying. + public static DatabaseOperationPhase Copying { get; } = new DatabaseOperationPhase(CopyingValue); + /// Catchup. + public static DatabaseOperationPhase Catchup { get; } = new DatabaseOperationPhase(CatchupValue); + /// WaitingForCutover. + public static DatabaseOperationPhase WaitingForCutover { get; } = new DatabaseOperationPhase(WaitingForCutoverValue); + /// CutoverInProgress. + public static DatabaseOperationPhase CutoverInProgress { get; } = new DatabaseOperationPhase(CutoverInProgressValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseOperationPhase left, DatabaseOperationPhase right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseOperationPhase left, DatabaseOperationPhase right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DatabaseOperationPhase(string value) => new DatabaseOperationPhase(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseOperationPhase other && Equals(other); + /// + public bool Equals(DatabaseOperationPhase other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.Serialization.cs new file mode 100644 index 0000000000000..974ce7dbf87b9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DatabaseOperationPhaseDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseOperationPhaseDetails)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Phase)) + { + writer.WritePropertyName("phase"u8); + writer.WriteStringValue(Phase.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PhaseInformation)) + { + writer.WritePropertyName("phaseInformation"u8); + writer.WriteStartObject(); + foreach (var item in PhaseInformation) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DatabaseOperationPhaseDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseOperationPhaseDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseOperationPhaseDetails(document.RootElement, options); + } + + internal static DatabaseOperationPhaseDetails DeserializeDatabaseOperationPhaseDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseOperationPhase? phase = default; + IReadOnlyDictionary phaseInformation = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phase"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + phase = new DatabaseOperationPhase(property.Value.GetString()); + continue; + } + if (property.NameEquals("phaseInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + phaseInformation = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseOperationPhaseDetails(phase, phaseInformation ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Phase), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" phase: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Phase)) + { + builder.Append(" phase: "); + builder.AppendLine($"'{Phase.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PhaseInformation), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" phaseInformation: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(PhaseInformation)) + { + if (PhaseInformation.Any()) + { + builder.Append(" phaseInformation: "); + builder.AppendLine("{"); + foreach (var item in PhaseInformation) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DatabaseOperationPhaseDetails)} does not support writing '{options.Format}' format."); + } + } + + DatabaseOperationPhaseDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDatabaseOperationPhaseDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseOperationPhaseDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.cs new file mode 100644 index 0000000000000..80cd287cb20f3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseOperationPhaseDetails.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The phase details properties of a database operation. + public partial class DatabaseOperationPhaseDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DatabaseOperationPhaseDetails() + { + PhaseInformation = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The operation phase. + /// The operation phase information. + /// Keeps track of any properties unknown to the library. + internal DatabaseOperationPhaseDetails(DatabaseOperationPhase? phase, IReadOnlyDictionary phaseInformation, IDictionary serializedAdditionalRawData) + { + Phase = phase; + PhaseInformation = phaseInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The operation phase. + [WirePath("phase")] + public DatabaseOperationPhase? Phase { get; } + /// The operation phase information. + [WirePath("phaseInformation")] + public IReadOnlyDictionary PhaseInformation { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupDatabasesSecondaryType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupDatabasesSecondaryType.cs new file mode 100644 index 0000000000000..62bc234fe814d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupDatabasesSecondaryType.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 +{ + /// Databases secondary type on partner server. + public readonly partial struct FailoverGroupDatabasesSecondaryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FailoverGroupDatabasesSecondaryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GeoValue = "Geo"; + private const string StandbyValue = "Standby"; + + /// Geo. + public static FailoverGroupDatabasesSecondaryType Geo { get; } = new FailoverGroupDatabasesSecondaryType(GeoValue); + /// Standby. + public static FailoverGroupDatabasesSecondaryType Standby { get; } = new FailoverGroupDatabasesSecondaryType(StandbyValue); + /// Determines if two values are the same. + public static bool operator ==(FailoverGroupDatabasesSecondaryType left, FailoverGroupDatabasesSecondaryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FailoverGroupDatabasesSecondaryType left, FailoverGroupDatabasesSecondaryType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FailoverGroupDatabasesSecondaryType(string value) => new FailoverGroupDatabasesSecondaryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FailoverGroupDatabasesSecondaryType other && Equals(other); + /// + public bool Equals(FailoverGroupDatabasesSecondaryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.Serialization.cs index bac308bb6bd21..ad192432a8db6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.Serialization.cs @@ -74,6 +74,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(SecondaryType)) + { + writer.WritePropertyName("secondaryType"u8); + writer.WriteStringValue(SecondaryType.Value.ToString()); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -118,6 +123,7 @@ internal static FailoverGroupPatch DeserializeFailoverGroupPatch(JsonElement ele FailoverGroupReadOnlyEndpoint readOnlyEndpoint = default; IList databases = default; IList partnerServers = default; + FailoverGroupDatabasesSecondaryType? secondaryType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -198,6 +204,15 @@ internal static FailoverGroupPatch DeserializeFailoverGroupPatch(JsonElement ele partnerServers = array; continue; } + if (property0.NameEquals("secondaryType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secondaryType = new FailoverGroupDatabasesSecondaryType(property0.Value.GetString()); + continue; + } } continue; } @@ -213,6 +228,7 @@ internal static FailoverGroupPatch DeserializeFailoverGroupPatch(JsonElement ele readOnlyEndpoint, databases ?? new ChangeTrackingList(), partnerServers ?? new ChangeTrackingList(), + secondaryType, serializedAdditionalRawData); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.cs index fda14caa01aea..fdb0d21b3ae60 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverGroupPatch.cs @@ -60,14 +60,16 @@ public FailoverGroupPatch() /// Read-only endpoint of the failover group instance. /// List of databases in the failover group. /// List of partner server information for the failover group. + /// Databases secondary type on partner server. /// Keeps track of any properties unknown to the library. - internal FailoverGroupPatch(IDictionary tags, FailoverGroupReadWriteEndpoint readWriteEndpoint, FailoverGroupReadOnlyEndpoint readOnlyEndpoint, IList failoverDatabases, IList partnerServers, IDictionary serializedAdditionalRawData) + internal FailoverGroupPatch(IDictionary tags, FailoverGroupReadWriteEndpoint readWriteEndpoint, FailoverGroupReadOnlyEndpoint readOnlyEndpoint, IList failoverDatabases, IList partnerServers, FailoverGroupDatabasesSecondaryType? secondaryType, IDictionary serializedAdditionalRawData) { Tags = tags; ReadWriteEndpoint = readWriteEndpoint; ReadOnlyEndpoint = readOnlyEndpoint; FailoverDatabases = failoverDatabases; PartnerServers = partnerServers; + SecondaryType = secondaryType; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -86,5 +88,8 @@ internal FailoverGroupPatch(IDictionary tags, FailoverGroupReadW /// List of partner server information for the failover group. [WirePath("properties.partnerServers")] public IList PartnerServers { get; } + /// Databases secondary type on partner server. + [WirePath("properties.secondaryType")] + public FailoverGroupDatabasesSecondaryType? SecondaryType { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs index afbcec0b54bff..fed6f504fcadf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// Link type (GEO, NAMED, STANDBY). + /// Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. public readonly partial struct ReplicationLinkType : IEquatable { private readonly string _value; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.Serialization.cs new file mode 100644 index 0000000000000..1717ae1153d5f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.Serialization.cs @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class SqlServerDatabaseReplicationLinkPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SqlServerDatabaseReplicationLinkPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(LinkType)) + { + writer.WritePropertyName("linkType"u8); + writer.WriteStringValue(LinkType.Value.ToString()); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SqlServerDatabaseReplicationLinkPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SqlServerDatabaseReplicationLinkPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSqlServerDatabaseReplicationLinkPatch(document.RootElement, options); + } + + internal static SqlServerDatabaseReplicationLinkPatch DeserializeSqlServerDatabaseReplicationLinkPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + ReplicationLinkType? linkType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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("linkType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + linkType = new ReplicationLinkType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SqlServerDatabaseReplicationLinkPatch( + id, + name, + type, + systemData, + linkType, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinkType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" linkType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LinkType)) + { + builder.Append(" linkType: "); + builder.AppendLine($"'{LinkType.Value.ToString()}'"); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SqlServerDatabaseReplicationLinkPatch)} does not support writing '{options.Format}' format."); + } + } + + SqlServerDatabaseReplicationLinkPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSqlServerDatabaseReplicationLinkPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SqlServerDatabaseReplicationLinkPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.cs new file mode 100644 index 0000000000000..120d6f0bb14ad --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlServerDatabaseReplicationLinkPatch.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A replication link update request. + public partial class SqlServerDatabaseReplicationLinkPatch : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SqlServerDatabaseReplicationLinkPatch() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. + /// Keeps track of any properties unknown to the library. + internal SqlServerDatabaseReplicationLinkPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReplicationLinkType? linkType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + LinkType = linkType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. + [WirePath("properties.linkType")] + public ReplicationLinkType? LinkType { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseRestOperations.cs index 8f8fe82dbe450..eaa109200931c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseRestOperations.cs @@ -32,11 +32,11 @@ public DatabaseRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-02-01-preview"; + _apiVersion = apiVersion ?? "2022-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCancelRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId) + internal RequestUriBuilder CreateListByDatabaseRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -48,18 +48,16 @@ internal RequestUriBuilder CreateCancelRequestUri(string subscriptionId, string uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/operations/", false); - uri.AppendPath(operationId, true); - uri.AppendPath("/cancel", false); + uri.AppendPath("/operations", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCancelRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { 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); @@ -70,70 +68,77 @@ internal HttpMessage CreateCancelRequest(string subscriptionId, string resourceG uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/operations/", false); - uri.AppendPath(operationId, true); - uri.AppendPath("/cancel", false); + uri.AppendPath("/operations", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Cancels the asynchronous operation on the database. + /// Gets a list of operations performed on the database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// The operation identifier. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CancelAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId, 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 = CreateCancelRequest(subscriptionId, resourceGroupName, serverName, databaseName, operationId); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + { + DatabaseOperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseOperationListResult.DeserializeDatabaseOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Cancels the asynchronous operation on the database. + /// Gets a list of operations performed on the database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// The operation identifier. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Cancel(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId, 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 = CreateCancelRequest(subscriptionId, resourceGroupName, serverName, databaseName, operationId); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + { + DatabaseOperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseOperationListResult.DeserializeDatabaseOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByDatabaseRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal RequestUriBuilder CreateCancelRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -145,16 +150,18 @@ internal RequestUriBuilder CreateListByDatabaseRequestUri(string subscriptionId, uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/operations", false); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/cancel", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateCancelRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId) { 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); @@ -165,71 +172,64 @@ internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string r uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/operations", false); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/cancel", 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 operations performed on the database. + /// Cancels the asynchronous operation on the database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The operation identifier. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task CancelAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateCancelRequest(subscriptionId, resourceGroupName, serverName, databaseName, operationId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - DatabaseOperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseOperationListResult.DeserializeDatabaseOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets a list of operations performed on the database. + /// Cancels the asynchronous operation on the database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The operation identifier. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Cancel(string subscriptionId, string resourceGroupName, string serverName, string databaseName, Guid operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateCancelRequest(subscriptionId, resourceGroupName, serverName, databaseName, operationId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - DatabaseOperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseOperationListResult.DeserializeDatabaseOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/FailoverGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/FailoverGroupsRestOperations.cs index 059590482ef92..c684bd9f598f0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/FailoverGroupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/FailoverGroupsRestOperations.cs @@ -32,7 +32,7 @@ public FailoverGroupsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-02-01-preview"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs index 19980bb125886..3437081fe907d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ReplicationLinksRestOperations.cs @@ -32,7 +32,7 @@ public ReplicationLinksRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-02-01-preview"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -250,6 +250,114 @@ public Response Get(string subscriptionId, } } + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/replicationLinks/", false); + uri.AppendPath(linkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkData 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("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/replicationLinks/", false); + uri.AppendPath(linkId, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the replication link type. + /// 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 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 CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkData 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.AssertNotNullOrEmpty(linkId, nameof(linkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the replication link type. + /// 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 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 CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkData 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.AssertNotNullOrEmpty(linkId, nameof(linkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) { var uri = new RawRequestUriBuilder(); @@ -349,6 +457,114 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s } } + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/replicationLinks/", false); + uri.AppendPath(linkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/replicationLinks/", false); + uri.AppendPath(linkId, 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(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the replication link type. + /// 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 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 UpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the replication link type. + /// 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 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 Update(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId, SqlServerDatabaseReplicationLinkPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, linkId, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateFailoverRequestUri(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs index 0c82451d2890f..62bd9e9c08769 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs @@ -48,8 +48,6 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly RestorePointsRestOperations _sqlServerDatabaseRestorePointRestorePointsRestClient; private readonly ClientDiagnostics _databaseExtensionsClientDiagnostics; private readonly DatabaseExtensionsRestOperations _databaseExtensionsRestClient; - private readonly ClientDiagnostics _databaseOperationsClientDiagnostics; - private readonly DatabaseRestOperations _databaseOperationsRestClient; private readonly ClientDiagnostics _databaseUsagesClientDiagnostics; private readonly DatabaseUsagesRestOperations _databaseUsagesRestClient; private readonly ClientDiagnostics _sqlDatabaseSensitivityLabelSensitivityLabelsClientDiagnostics; @@ -58,6 +56,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly SynapseLinkWorkspacesRestOperations _synapseLinkWorkspacesRestClient; private readonly ClientDiagnostics _databaseEncryptionProtectorsClientDiagnostics; private readonly DatabaseEncryptionProtectorsRestOperations _databaseEncryptionProtectorsRestClient; + private readonly ClientDiagnostics _databaseOperationsClientDiagnostics; + private readonly DatabaseRestOperations _databaseOperationsRestClient; private readonly SqlDatabaseData _data; /// Gets the resource type for the operations. @@ -97,8 +97,6 @@ internal SqlDatabaseResource(ArmClient client, ResourceIdentifier id) : base(cli _sqlServerDatabaseRestorePointRestorePointsRestClient = new RestorePointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sqlServerDatabaseRestorePointRestorePointsApiVersion); _databaseExtensionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseExtensionsRestClient = new DatabaseExtensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _databaseOperationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _databaseOperationsRestClient = new DatabaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _databaseUsagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseUsagesRestClient = new DatabaseUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _sqlDatabaseSensitivityLabelSensitivityLabelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", SqlDatabaseSensitivityLabelResource.ResourceType.Namespace, Diagnostics); @@ -108,6 +106,8 @@ internal SqlDatabaseResource(ArmClient client, ResourceIdentifier id) : base(cli _synapseLinkWorkspacesRestClient = new SynapseLinkWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _databaseEncryptionProtectorsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _databaseEncryptionProtectorsRestClient = new DatabaseEncryptionProtectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _databaseOperationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _databaseOperationsRestClient = new DatabaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -1092,75 +1092,6 @@ public virtual Response GetDatabaseAdv return GetDatabaseAdvancedThreatProtections().Get(advancedThreatProtectionName, cancellationToken); } - /// Gets a collection of SqlServerDatabaseReplicationLinkResources in the SqlDatabase. - /// An object representing collection of SqlServerDatabaseReplicationLinkResources and their operations over a SqlServerDatabaseReplicationLinkResource. - public virtual SqlServerDatabaseReplicationLinkCollection GetSqlServerDatabaseReplicationLinks() - { - return GetCachedClient(client => new SqlServerDatabaseReplicationLinkCollection(client, Id)); - } - - /// - /// Gets a replication link. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} - /// - /// - /// Operation Id - /// ReplicationLinks_Get - /// - /// - /// Default Api Version - /// 2022-02-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the replication link. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetSqlServerDatabaseReplicationLinkAsync(string linkId, CancellationToken cancellationToken = default) - { - return await GetSqlServerDatabaseReplicationLinks().GetAsync(linkId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a replication link. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} - /// - /// - /// Operation Id - /// ReplicationLinks_Get - /// - /// - /// Default Api Version - /// 2022-02-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the replication link. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetSqlServerDatabaseReplicationLink(string linkId, CancellationToken cancellationToken = default) - { - return GetSqlServerDatabaseReplicationLinks().Get(linkId, cancellationToken); - } - /// Gets a collection of LogicalDatabaseTransparentDataEncryptionResources in the SqlDatabase. /// An object representing collection of LogicalDatabaseTransparentDataEncryptionResources and their operations over a LogicalDatabaseTransparentDataEncryptionResource. public virtual LogicalDatabaseTransparentDataEncryptionCollection GetLogicalDatabaseTransparentDataEncryptions() @@ -1356,6 +1287,75 @@ public virtual Response GetLongTermRetentionPol return GetLongTermRetentionPolicies().Get(policyName, cancellationToken); } + /// Gets a collection of SqlServerDatabaseReplicationLinkResources in the SqlDatabase. + /// An object representing collection of SqlServerDatabaseReplicationLinkResources and their operations over a SqlServerDatabaseReplicationLinkResource. + public virtual SqlServerDatabaseReplicationLinkCollection GetSqlServerDatabaseReplicationLinks() + { + return GetCachedClient(client => new SqlServerDatabaseReplicationLinkCollection(client, Id)); + } + + /// + /// Gets a replication link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_Get + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the replication link. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlServerDatabaseReplicationLinkAsync(string linkId, CancellationToken cancellationToken = default) + { + return await GetSqlServerDatabaseReplicationLinks().GetAsync(linkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a replication link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_Get + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the replication link. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlServerDatabaseReplicationLink(string linkId, CancellationToken cancellationToken = default) + { + return GetSqlServerDatabaseReplicationLinks().Get(linkId, cancellationToken); + } + /// /// Gets a database. /// @@ -2028,128 +2028,6 @@ public virtual Pageable GetDatabaseExtens return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ImportExportExtensionsOperationResult.DeserializeImportExportExtensionsOperationResult(e), _databaseExtensionsClientDiagnostics, Pipeline, "SqlDatabaseResource.GetDatabaseExtensions", "value", "nextLink", cancellationToken); } - /// - /// Cancels the asynchronous operation on the database. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel - /// - /// - /// Operation Id - /// DatabaseOperations_Cancel - /// - /// - /// Default Api Version - /// 2021-02-01-preview - /// - /// - /// - /// The operation identifier. - /// The cancellation token to use. - public virtual async Task CancelDatabaseOperationAsync(Guid operationId, CancellationToken cancellationToken = default) - { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); - scope.Start(); - try - { - var response = await _databaseOperationsRestClient.CancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Cancels the asynchronous operation on the database. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel - /// - /// - /// Operation Id - /// DatabaseOperations_Cancel - /// - /// - /// Default Api Version - /// 2021-02-01-preview - /// - /// - /// - /// The operation identifier. - /// The cancellation token to use. - public virtual Response CancelDatabaseOperation(Guid operationId, CancellationToken cancellationToken = default) - { - using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); - scope.Start(); - try - { - var response = _databaseOperationsRestClient.Cancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of operations performed on the database. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations - /// - /// - /// Operation Id - /// DatabaseOperations_ListByDatabase - /// - /// - /// Default Api Version - /// 2021-02-01-preview - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatabaseOperationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _databaseOperationsRestClient.CreateListByDatabaseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseOperationsRestClient.CreateListByDatabaseNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DatabaseOperationData.DeserializeDatabaseOperationData(e), _databaseOperationsClientDiagnostics, Pipeline, "SqlDatabaseResource.GetDatabaseOperations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of operations performed on the database. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations - /// - /// - /// Operation Id - /// DatabaseOperations_ListByDatabase - /// - /// - /// Default Api Version - /// 2021-02-01-preview - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatabaseOperations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _databaseOperationsRestClient.CreateListByDatabaseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseOperationsRestClient.CreateListByDatabaseNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DatabaseOperationData.DeserializeDatabaseOperationData(e), _databaseOperationsClientDiagnostics, Pipeline, "SqlDatabaseResource.GetDatabaseOperations", "value", "nextLink", cancellationToken); - } - /// /// Gets database usages. /// @@ -3316,6 +3194,128 @@ public virtual ArmOperation UpgradeDataWarehouse(WaitUntil waitUntil, Cancellati } } + /// + /// Gets a list of operations performed on the database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations + /// + /// + /// Operation Id + /// DatabaseOperations_ListByDatabase + /// + /// + /// Default Api Version + /// 2022-11-01-preview + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseOperationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _databaseOperationsRestClient.CreateListByDatabaseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseOperationsRestClient.CreateListByDatabaseNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DatabaseOperationData.DeserializeDatabaseOperationData(e), _databaseOperationsClientDiagnostics, Pipeline, "SqlDatabaseResource.GetDatabaseOperations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of operations performed on the database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations + /// + /// + /// Operation Id + /// DatabaseOperations_ListByDatabase + /// + /// + /// Default Api Version + /// 2022-11-01-preview + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseOperations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _databaseOperationsRestClient.CreateListByDatabaseRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseOperationsRestClient.CreateListByDatabaseNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DatabaseOperationData.DeserializeDatabaseOperationData(e), _databaseOperationsClientDiagnostics, Pipeline, "SqlDatabaseResource.GetDatabaseOperations", "value", "nextLink", cancellationToken); + } + + /// + /// Cancels the asynchronous operation on the database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel + /// + /// + /// Operation Id + /// DatabaseOperations_Cancel + /// + /// + /// Default Api Version + /// 2022-11-01-preview + /// + /// + /// + /// The operation identifier. + /// The cancellation token to use. + public virtual async Task CancelDatabaseOperationAsync(Guid operationId, CancellationToken cancellationToken = default) + { + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); + scope.Start(); + try + { + var response = await _databaseOperationsRestClient.CancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Cancels the asynchronous operation on the database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel + /// + /// + /// Operation Id + /// DatabaseOperations_Cancel + /// + /// + /// Default Api Version + /// 2022-11-01-preview + /// + /// + /// + /// The operation identifier. + /// The cancellation token to use. + public virtual Response CancelDatabaseOperation(Guid operationId, CancellationToken cancellationToken = default) + { + using var scope = _databaseOperationsClientDiagnostics.CreateScope("SqlDatabaseResource.CancelDatabaseOperation"); + scope.Start(); + try + { + var response = _databaseOperationsRestClient.Cancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Add a tag to the current resource. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs index b277742dd6620..129e3b73c0f5f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs @@ -51,6 +51,104 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SqlDatabaseResource.ResourceType), nameof(id)); } + /// + /// Updates the replication link type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string linkId, SqlServerDatabaseReplicationLinkData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics.CreateScope("SqlServerDatabaseReplicationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new SqlServerDatabaseReplicationLinkOperationSource(Client), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the replication link type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string linkId, SqlServerDatabaseReplicationLinkData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics.CreateScope("SqlServerDatabaseReplicationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, data, cancellationToken); + var operation = new SqlArmOperation(new SqlServerDatabaseReplicationLinkOperationSource(Client), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Gets a replication link. /// @@ -64,7 +162,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -109,7 +207,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -154,7 +252,7 @@ public virtual Response Get(string lin /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -184,7 +282,7 @@ public virtual AsyncPageable GetAllAsy /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -214,7 +312,7 @@ public virtual Pageable GetAll(Cancell /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -257,7 +355,7 @@ public virtual async Task> ExistsAsync(string linkId, Cancellatio /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -300,7 +398,7 @@ public virtual Response Exists(string linkId, CancellationToken cancellati /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -345,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.Serialization.cs index 78328b10121be..57908f4df95a1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.Serialization.cs @@ -61,6 +61,11 @@ void IJsonModel.Write(Utf8JsonWriter write writer.WritePropertyName("partnerDatabase"u8); writer.WriteStringValue(PartnerDatabase); } + if (options.Format != "W" && Optional.IsDefined(PartnerDatabaseId)) + { + writer.WritePropertyName("partnerDatabaseId"u8); + writer.WriteStringValue(PartnerDatabaseId); + } if (options.Format != "W" && Optional.IsDefined(PartnerLocation)) { writer.WritePropertyName("partnerLocation"u8); @@ -101,7 +106,7 @@ void IJsonModel.Write(Utf8JsonWriter write writer.WritePropertyName("isTerminationAllowed"u8); writer.WriteBooleanValue(IsTerminationAllowed.Value); } - if (options.Format != "W" && Optional.IsDefined(LinkType)) + if (Optional.IsDefined(LinkType)) { writer.WritePropertyName("linkType"u8); writer.WriteStringValue(LinkType.Value.ToString()); @@ -151,6 +156,7 @@ internal static SqlServerDatabaseReplicationLinkData DeserializeSqlServerDatabas SystemData systemData = default; string partnerServer = default; string partnerDatabase = default; + string partnerDatabaseId = default; AzureLocation? partnerLocation = default; SqlServerDatabaseReplicationRole? role = default; SqlServerDatabaseReplicationRole? partnerRole = default; @@ -207,6 +213,11 @@ internal static SqlServerDatabaseReplicationLinkData DeserializeSqlServerDatabas partnerDatabase = property0.Value.GetString(); continue; } + if (property0.NameEquals("partnerDatabaseId"u8)) + { + partnerDatabaseId = property0.Value.GetString(); + continue; + } if (property0.NameEquals("partnerLocation"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -300,6 +311,7 @@ internal static SqlServerDatabaseReplicationLinkData DeserializeSqlServerDatabas systemData, partnerServer, partnerDatabase, + partnerDatabaseId, partnerLocation, role, partnerRole, @@ -424,6 +436,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PartnerDatabaseId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" partnerDatabaseId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PartnerDatabaseId)) + { + builder.Append(" partnerDatabaseId: "); + if (PartnerDatabaseId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PartnerDatabaseId}'''"); + } + else + { + builder.AppendLine($"'{PartnerDatabaseId}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PartnerLocation), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.cs index d0551234ec4d8..6dcc552a57402 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkData.cs @@ -63,6 +63,7 @@ public SqlServerDatabaseReplicationLinkData() /// The systemData. /// Resource partner server. /// Resource partner database. + /// Resource partner database Id. /// Resource partner location. /// Local replication role. /// Partner replication role. @@ -71,12 +72,13 @@ public SqlServerDatabaseReplicationLinkData() /// Seeding completion percentage for the link. /// Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). /// Whether the user is currently allowed to terminate the link. - /// Link type (GEO, NAMED, STANDBY). + /// Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. /// Keeps track of any properties unknown to the library. - internal SqlServerDatabaseReplicationLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string partnerServer, string partnerDatabase, AzureLocation? partnerLocation, SqlServerDatabaseReplicationRole? role, SqlServerDatabaseReplicationRole? partnerRole, string replicationMode, DateTimeOffset? startOn, int? percentComplete, ReplicationLinkState? replicationState, bool? isTerminationAllowed, ReplicationLinkType? linkType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal SqlServerDatabaseReplicationLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string partnerServer, string partnerDatabase, string partnerDatabaseId, AzureLocation? partnerLocation, SqlServerDatabaseReplicationRole? role, SqlServerDatabaseReplicationRole? partnerRole, string replicationMode, DateTimeOffset? startOn, int? percentComplete, ReplicationLinkState? replicationState, bool? isTerminationAllowed, ReplicationLinkType? linkType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PartnerServer = partnerServer; PartnerDatabase = partnerDatabase; + PartnerDatabaseId = partnerDatabaseId; PartnerLocation = partnerLocation; Role = role; PartnerRole = partnerRole; @@ -95,6 +97,9 @@ internal SqlServerDatabaseReplicationLinkData(ResourceIdentifier id, string name /// Resource partner database. [WirePath("properties.partnerDatabase")] public string PartnerDatabase { get; } + /// Resource partner database Id. + [WirePath("properties.partnerDatabaseId")] + public string PartnerDatabaseId { get; } /// Resource partner location. [WirePath("properties.partnerLocation")] public AzureLocation? PartnerLocation { get; } @@ -119,8 +124,8 @@ internal SqlServerDatabaseReplicationLinkData(ResourceIdentifier id, string name /// Whether the user is currently allowed to terminate the link. [WirePath("properties.isTerminationAllowed")] public bool? IsTerminationAllowed { get; } - /// Link type (GEO, NAMED, STANDBY). + /// Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. [WirePath("properties.linkType")] - public ReplicationLinkType? LinkType { get; } + public ReplicationLinkType? LinkType { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs index a51cd286b554e..1dfe2649e97dd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql { @@ -102,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -142,7 +143,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -182,7 +183,7 @@ public virtual Response Get(Cancellati /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -224,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -253,6 +254,98 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } } + /// + /// Updates the replication link type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_Update + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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> UpdateAsync(WaitUntil waitUntil, SqlServerDatabaseReplicationLinkPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics.CreateScope("SqlServerDatabaseReplicationLinkResource.Update"); + scope.Start(); + try + { + var response = await _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new SqlServerDatabaseReplicationLinkOperationSource(Client), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the replication link type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_Update + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 Update(WaitUntil waitUntil, SqlServerDatabaseReplicationLinkPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics.CreateScope("SqlServerDatabaseReplicationLinkResource.Update"); + scope.Start(); + try + { + var response = _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new SqlArmOperation(new SqlServerDatabaseReplicationLinkOperationSource(Client), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Fails over from the current primary server to this server. /// @@ -266,7 +359,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -308,7 +401,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -350,7 +443,7 @@ public virtual ArmOperation Failover(W /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -392,7 +485,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2022-02-01-preview + /// 2023-05-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs index 61ba71d334e42..5ba10f5694846 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs @@ -44,10 +44,10 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ServerRestOperations _serverOperationsRestClient; private readonly ClientDiagnostics _tdeCertificatesClientDiagnostics; private readonly TdeCertificatesRestOperations _tdeCertificatesRestClient; - private readonly ClientDiagnostics _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics; - private readonly ReplicationLinksRestOperations _sqlServerDatabaseReplicationLinkReplicationLinksRestClient; private readonly ClientDiagnostics _sqlDatabaseDatabasesClientDiagnostics; private readonly DatabasesRestOperations _sqlDatabaseDatabasesRestClient; + private readonly ClientDiagnostics _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics; + private readonly ReplicationLinksRestOperations _sqlServerDatabaseReplicationLinkReplicationLinksRestClient; private readonly SqlServerData _data; /// Gets the resource type for the operations. @@ -81,12 +81,12 @@ internal SqlServerResource(ArmClient client, ResourceIdentifier id) : base(clien _serverOperationsRestClient = new ServerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _tdeCertificatesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); _tdeCertificatesRestClient = new TdeCertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerDatabaseReplicationLinkResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(SqlServerDatabaseReplicationLinkResource.ResourceType, out string sqlServerDatabaseReplicationLinkReplicationLinksApiVersion); - _sqlServerDatabaseReplicationLinkReplicationLinksRestClient = new ReplicationLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sqlServerDatabaseReplicationLinkReplicationLinksApiVersion); _sqlDatabaseDatabasesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", SqlDatabaseResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(SqlDatabaseResource.ResourceType, out string sqlDatabaseDatabasesApiVersion); _sqlDatabaseDatabasesRestClient = new DatabasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sqlDatabaseDatabasesApiVersion); + _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerDatabaseReplicationLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SqlServerDatabaseReplicationLinkResource.ResourceType, out string sqlServerDatabaseReplicationLinkReplicationLinksApiVersion); + _sqlServerDatabaseReplicationLinkReplicationLinksRestClient = new ReplicationLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sqlServerDatabaseReplicationLinkReplicationLinksApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -2044,7 +2044,7 @@ public virtual FailoverGroupCollection GetFailoverGroups() /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2075,7 +2075,7 @@ public virtual async Task> GetFailoverGroupAsync /// /// /// Default Api Version - /// 2023-02-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2537,66 +2537,6 @@ public virtual ArmOperation CreateTdeCertificate(WaitUntil waitUntil, TdeCertifi } } - /// - /// Gets a list of replication links. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks - /// - /// - /// Operation Id - /// ReplicationLinks_ListByServer - /// - /// - /// Default Api Version - /// 2022-02-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetReplicationLinksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlServerDatabaseReplicationLinkResource(Client, SqlServerDatabaseReplicationLinkData.DeserializeSqlServerDatabaseReplicationLinkData(e)), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, "SqlServerResource.GetReplicationLinks", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of replication links. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks - /// - /// - /// Operation Id - /// ReplicationLinks_ListByServer - /// - /// - /// Default Api Version - /// 2022-02-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetReplicationLinks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlServerDatabaseReplicationLinkResource(Client, SqlServerDatabaseReplicationLinkData.DeserializeSqlServerDatabaseReplicationLinkData(e)), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, "SqlServerResource.GetReplicationLinks", "value", "nextLink", cancellationToken); - } - /// /// Gets a list of inaccessible databases in a logical server /// @@ -2833,6 +2773,66 @@ public virtual ArmOperation Refr } } + /// + /// Gets a list of replication links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks + /// + /// + /// Operation Id + /// ReplicationLinks_ListByServer + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReplicationLinksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlServerDatabaseReplicationLinkResource(Client, SqlServerDatabaseReplicationLinkData.DeserializeSqlServerDatabaseReplicationLinkData(e)), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, "SqlServerResource.GetReplicationLinks", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of replication links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks + /// + /// + /// Operation Id + /// ReplicationLinks_ListByServer + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReplicationLinks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlServerDatabaseReplicationLinkResource(Client, SqlServerDatabaseReplicationLinkData.DeserializeSqlServerDatabaseReplicationLinkData(e)), _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics, Pipeline, "SqlServerResource.GetReplicationLinks", "value", "nextLink", cancellationToken); + } + /// /// Add a tag to the current resource. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index 1f0aeb2a7215f..6a47c694e969a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md @@ -5,7 +5,8 @@ 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/e7e476ba9cd5dcaacb4b344a0ca9677ba731686b/specification/sql/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/f45a76fc39f033947ed12faf4b6416e1e19724cd/specification/sql/resource-manager/readme.md +#package-composite-v5 namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated clear-output-folder: true @@ -27,6 +28,9 @@ head-as-boolean: false use-model-reader-writer: true enable-bicep-serialization: true +#mgmt-debug: +# show-serialized-names: true + # this is temporary, to be removed when we find the owner of this feature operation-groups-to-omit: - JobPrivateEndpoints @@ -351,12 +355,12 @@ rename-mapping: ServerUpdate.properties.minimalTlsVersion: minTlsVersion MinimalTlsVersion: SqlMinimalTlsVersion BackupStorageAccessTier: SqlBackupStorageAccessTier - -# mgmt-debug: -# show-serialized-names: true + Phase: DatabaseOperationPhase + PhaseDetails: DatabaseOperationPhaseDetails prompted-enum-values: - Default + directive: - remove-operation: ManagedDatabaseMoveOperations_ListByLocation - remove-operation: ManagedDatabaseMoveOperations_Get